delete.asciidoc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. [[delete]]
  2. == Delete API
  3. The delete API allows one to delete a typed JSON document from a specific
  4. index based on its id. The following example deletes the JSON document
  5. from an index called twitter, under a type called tweet, with id valued
  6. 1:
  7. [source,java]
  8. --------------------------------------------------
  9. DeleteResponse response = client.prepareDelete("twitter", "tweet", "1")
  10. .execute()
  11. .actionGet();
  12. --------------------------------------------------
  13. For more information on the delete operation, check out the
  14. {ref}/docs-delete.html[delete API] docs.
  15. [[operation-threading]]
  16. === Operation Threading
  17. The delete API allows to set the threading model the operation will be
  18. performed when the actual execution of the API is performed on the same
  19. node (the API is executed on a shard that is allocated on the same
  20. server).
  21. The options are to execute the operation on a different thread, or to
  22. execute it on the calling thread (note that the API is still async). By
  23. default, `operationThreaded` is set to `true` which means the operation
  24. is executed on a different thread. Here is an example that sets it to
  25. `false`:
  26. [source,java]
  27. --------------------------------------------------
  28. DeleteResponse response = client.prepareDelete("twitter", "tweet", "1")
  29. .setOperationThreaded(false)
  30. .execute()
  31. .actionGet();
  32. --------------------------------------------------