delete-job.asciidoc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. [[java-rest-high-x-pack-ml-delete-job]]
  2. === Delete Job API
  3. [[java-rest-high-x-pack-machine-learning-delete-job-request]]
  4. ==== Delete Job Request
  5. A `DeleteJobRequest` object requires a non-null `jobId` and can optionally set `force`.
  6. Can be executed as follows:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. ---------------------------------------------------
  9. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-delete-ml-job-request]
  10. ---------------------------------------------------
  11. <1> Use to forcefully delete an opened job;
  12. this method is quicker than closing and deleting the job.
  13. Defaults to `false`
  14. [[java-rest-high-x-pack-machine-learning-delete-job-response]]
  15. ==== Delete Job Response
  16. The returned `DeleteJobResponse` object indicates the acknowledgement of the request:
  17. ["source","java",subs="attributes,callouts,macros"]
  18. ---------------------------------------------------
  19. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-delete-ml-job-response]
  20. ---------------------------------------------------
  21. <1> `isAcknowledged` was the deletion request acknowledged or not
  22. [[java-rest-high-x-pack-machine-learning-delete-job-async]]
  23. ==== Delete Job Asynchronously
  24. This request can also be made asynchronously.
  25. ["source","java",subs="attributes,callouts,macros"]
  26. ---------------------------------------------------
  27. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-delete-ml-job-request-async]
  28. ---------------------------------------------------
  29. <1> The `DeleteJobRequest` to execute and the `ActionListener` to alert on completion or error.
  30. The deletion request returns immediately. Once the request is completed, the `ActionListener` is
  31. called back using the `onResponse` or `onFailure`. The latter indicates some failure occurred when
  32. making the request.
  33. A typical listener for a `DeleteJobRequest` could be defined as follows:
  34. ["source","java",subs="attributes,callouts,macros"]
  35. ---------------------------------------------------
  36. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-delete-ml-job-request-listener]
  37. ---------------------------------------------------
  38. <1> The action to be taken when it is completed
  39. <2> What to do when a failure occurs