delete_script.asciidoc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. [[java-rest-high-delete-stored-script]]
  2. === Delete Stored Script API
  3. [[java-rest-high-delete-stored-script-request]]
  4. ==== Delete Stored Script Request
  5. A `DeleteStoredScriptRequest` requires an `id`:
  6. ["source","java",subs="attributes,callouts,macros"]
  7. --------------------------------------------------
  8. include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request]
  9. --------------------------------------------------
  10. <1> The id of the script
  11. ==== Optional arguments
  12. The following arguments can optionally be provided:
  13. ["source","java",subs="attributes,callouts,macros"]
  14. --------------------------------------------------
  15. include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request-timeout]
  16. --------------------------------------------------
  17. <1> Timeout to wait for the all the nodes to acknowledge the stored script is deleted as a `TimeValue`
  18. <2> Timeout to wait for the all the nodes to acknowledge the stored script is deleted as a `String`
  19. ["source","java",subs="attributes,callouts,macros"]
  20. --------------------------------------------------
  21. include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-request-masterTimeout]
  22. --------------------------------------------------
  23. <1> Timeout to connect to the master node as a `TimeValue`
  24. <2> Timeout to connect to the master node as a `String`
  25. [[java-rest-high-delete-stored-script-sync]]
  26. ==== Synchronous Execution
  27. ["source","java",subs="attributes,callouts,macros"]
  28. --------------------------------------------------
  29. include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute]
  30. --------------------------------------------------
  31. [[java-rest-high-delete-stored-script-async]]
  32. ==== Asynchronous Execution
  33. The asynchronous execution of a delete stored script request requires both the `DeleteStoredScriptRequest`
  34. instance and an `ActionListener` instance to be passed to the asynchronous method:
  35. ["source","java",subs="attributes,callouts,macros"]
  36. --------------------------------------------------
  37. include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute-async]
  38. --------------------------------------------------
  39. <1> The `DeleteStoredScriptRequest` to execute and the `ActionListener` to use when
  40. the execution completes
  41. [[java-rest-high-delete-stored-script-listener]]
  42. ===== Action Listener
  43. The asynchronous method does not block and returns immediately. Once it is
  44. completed the `ActionListener` is called back using the `onResponse` method
  45. if the execution successfully completed or using the `onFailure` method if
  46. it failed.
  47. A typical listener for `AcknowledgedResponse` looks like:
  48. ["source","java",subs="attributes,callouts,macros"]
  49. --------------------------------------------------
  50. include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-execute-listener]
  51. --------------------------------------------------
  52. <1> Called when the execution is successfully completed. The response is
  53. provided as an argument
  54. <2> Called in case of failure. The raised exception is provided as an argument
  55. [[java-rest-high-delete-stored-script-response]]
  56. ==== Delete Stored Script Response
  57. The returned `AcknowledgedResponse` allows to retrieve information about the
  58. executed operation as follows:
  59. ["source","java",subs="attributes,callouts,macros"]
  60. --------------------------------------------------
  61. include-tagged::{doc-tests}/StoredScriptsDocumentationIT.java[delete-stored-script-response]
  62. --------------------------------------------------
  63. <1> Indicates whether all of the nodes have acknowledged the request