json_replace.rst 635 B

1234567891011121314151617181920212223242526272829
  1. .. _http_json_replace:
  2. json/replace
  3. ------------
  4. ``json/replace`` works similar to SphinxQL's :ref:`insert_and_replace_syntax`. It inserts a new document into an index and if the index already has a document with the same id, it is deleted before the new document is inserted. There's also a synonym endpoint, ``json/index``.
  5. ::
  6. {
  7. "index":"test",
  8. "id":1,
  9. "doc":
  10. {
  11. "gid" : 10,
  12. "content" : "updated document"
  13. }
  14. }
  15. The daemon will respond with a JSON object stating if the operation was successfull or not:
  16. ::
  17. {
  18. "_index": "test",
  19. "_id": 1,
  20. "created": false,
  21. "result": "updated"
  22. }