delete.asciidoc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. --
  2. :api: asyncsearch-delete
  3. :request: DeleteAsyncSearchRequest
  4. :response: AcknowledgedResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Delete Async Search API
  9. [id="{upid}-{api}-request"]
  10. ==== Request
  11. A +{request}+ allows deleting a running asynchronous search task using
  12. its id. Required arguments are the `id` of a running search:
  13. ["source","java",subs="attributes,callouts,macros"]
  14. --------------------------------------------------
  15. include-tagged::{doc-tests-file}[{api}-request]
  16. --------------------------------------------------
  17. [id="{upid}-{api}-sync"]
  18. ==== Synchronous Execution
  19. ["source","java",subs="attributes,callouts,macros"]
  20. --------------------------------------------------
  21. include-tagged::{doc-tests-file}[{api}-execute]
  22. --------------------------------------------------
  23. <1> Execute the request and get back the response as an +{response}+ object.
  24. [id="{upid}-{api}-async"]
  25. ==== Asynchronous Execution
  26. The asynchronous execution of a +{request}+ allows to use an
  27. `ActionListener` to be called back when the submit request returns:
  28. ["source","java",subs="attributes,callouts,macros"]
  29. --------------------------------------------------
  30. include-tagged::{doc-tests-file}[{api}-execute-async]
  31. --------------------------------------------------
  32. <1> The +{request}+ to execute and the `ActionListener` to use when
  33. the execution completes
  34. The asynchronous method does not block and returns immediately. Once it is
  35. completed the `ActionListener` is called back using the `onResponse` method
  36. if the execution successfully completed or using the `onFailure` method if
  37. it failed.
  38. A typical listener for +{response}+ looks like:
  39. ["source","java",subs="attributes,callouts,macros"]
  40. --------------------------------------------------
  41. include-tagged::{doc-tests-file}[{api}-listener]
  42. --------------------------------------------------
  43. <1> Called when the execution is successfully completed. The response is
  44. provided as an argument
  45. <2> Called in case of failure. The raised exception is provided as an argument
  46. [id="{upid}-{api}-response"]
  47. ==== Response
  48. The returned +{response}+ indicates the acknowledgement of the request:
  49. ["source","java",subs="attributes,callouts,macros"]
  50. --------------------------------------------------
  51. include-tagged::{doc-tests-file}[{api}-response]
  52. --------------------------------------------------
  53. <1> `isAcknowledged` was the deletion request acknowledged or not.