1
0

delete-job.asciidoc 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. [role="xpack"]
  2. [[ml-delete-job]]
  3. = Delete {anomaly-jobs} API
  4. ++++
  5. <titleabbrev>Delete jobs</titleabbrev>
  6. ++++
  7. Deletes an existing {anomaly-job}.
  8. [[ml-delete-job-request]]
  9. == {api-request-title}
  10. `DELETE _ml/anomaly_detectors/<job_id>`
  11. [[ml-delete-job-prereqs]]
  12. == {api-prereq-title}
  13. * Requires the `manage_ml` cluster privilege. This privilege is included in the
  14. `machine_learning_admin` built-in role.
  15. * Before you can delete a job, you must close it (unless you specify the `force`
  16. parameter). See <<ml-close-job>>.
  17. [[ml-delete-job-desc]]
  18. == {api-description-title}
  19. All job configuration, model state and results are deleted.
  20. IMPORTANT: Deleting an {anomaly-job} must be done via this API only. Do not
  21. delete the job directly from the `.ml-*` indices using the {es} delete document
  22. API. When {es} {security-features} are enabled, make sure no `write` privileges
  23. are granted to anyone over the `.ml-*` indices.
  24. It is not currently possible to delete multiple jobs using wildcards or a comma
  25. separated list.
  26. If you delete a job that has a {dfeed}, the request first tries to delete the
  27. {dfeed}. This behavior is equivalent to calling
  28. <<ml-delete-datafeed,delete {dfeed}>> with the same `timeout` and `force`
  29. parameters as the delete job request.
  30. [[ml-delete-job-path-parms]]
  31. == {api-path-parms-title}
  32. `<job_id>`::
  33. (Required, string)
  34. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  35. [[ml-delete-job-query-parms]]
  36. == {api-query-parms-title}
  37. `force`::
  38. (Optional, Boolean) Use to forcefully delete an opened job; this method is
  39. quicker than closing and deleting the job.
  40. `wait_for_completion`::
  41. (Optional, Boolean) Specifies whether the request should return immediately or
  42. wait until the job deletion completes. Defaults to `true`.
  43. [[ml-delete-job-example]]
  44. == {api-examples-title}
  45. [source,console]
  46. --------------------------------------------------
  47. DELETE _ml/anomaly_detectors/total-requests
  48. --------------------------------------------------
  49. // TEST[skip:setup:server_metrics_job]
  50. When the job is deleted, you receive the following results:
  51. [source,console-result]
  52. ----
  53. {
  54. "acknowledged": true
  55. }
  56. ----
  57. In the next example we delete the `total-requests` job asynchronously:
  58. [source,console]
  59. --------------------------------------------------
  60. DELETE _ml/anomaly_detectors/total-requests?wait_for_completion=false
  61. --------------------------------------------------
  62. // TEST[skip:setup:server_metrics_job]
  63. When `wait_for_completion` is set to `false`, the response contains the id
  64. of the job deletion task:
  65. [source,console-result]
  66. ----
  67. {
  68. "task": "oTUltX4IQMOUUVeiohTt8A:39"
  69. }
  70. ----
  71. // TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]