delete-job.asciidoc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-delete-job]]
  4. === Delete Jobs API
  5. ++++
  6. <titleabbrev>Delete Jobs</titleabbrev>
  7. ++++
  8. Deletes an existing anomaly detection job.
  9. ==== Request
  10. `DELETE _xpack/ml/anomaly_detectors/<job_id>`
  11. ==== Description
  12. All job configuration, model state and results are deleted.
  13. IMPORTANT: Deleting a job must be done via this API only. Do not delete the
  14. job directly from the `.ml-*` indices using the Elasticsearch
  15. DELETE Document API. When {security} is enabled, make sure no `write`
  16. privileges are granted to anyone over the `.ml-*` indices.
  17. Before you can delete a job, you must delete the {dfeeds} that are associated
  18. with it. See <<ml-delete-datafeed,Delete {dfeeds-cap}>>. Unless the `force` parameter
  19. is used the job must be closed before it can be deleted.
  20. It is not currently possible to delete multiple jobs using wildcards or a comma
  21. separated list.
  22. ==== Path Parameters
  23. `job_id` (required)::
  24. (string) Identifier for the job
  25. ===== Query Parameters
  26. `force`::
  27. (boolean) Use to forcefully delete an opened job; this method is quicker than
  28. closing and deleting the job.
  29. `wait_for_completion`::
  30. (boolean) Specifies whether the request should return immediately or wait
  31. until the job deletion completes. Defaults to `true`.
  32. ==== Authorization
  33. You must have `manage_ml`, or `manage` cluster privileges to use this API.
  34. For more information, see {xpack-ref}/security-privileges.html[Security Privileges].
  35. ==== Examples
  36. The following example deletes the `total-requests` job:
  37. [source,js]
  38. --------------------------------------------------
  39. DELETE _xpack/ml/anomaly_detectors/total-requests
  40. --------------------------------------------------
  41. // CONSOLE
  42. // TEST[skip:setup:server_metrics_job]
  43. When the job is deleted, you receive the following results:
  44. [source,js]
  45. ----
  46. {
  47. "acknowledged": true
  48. }
  49. ----
  50. // TESTRESPONSE
  51. In the next example we delete the `total-requests` job asynchronously:
  52. [source,js]
  53. --------------------------------------------------
  54. DELETE _xpack/ml/anomaly_detectors/total-requests?wait_for_completion=false
  55. --------------------------------------------------
  56. // CONSOLE
  57. // TEST[skip:setup:server_metrics_job]
  58. When `wait_for_completion` is set to `false`, the response contains the id
  59. of the job deletion task:
  60. [source,js]
  61. ----
  62. {
  63. "task": "oTUltX4IQMOUUVeiohTt8A:39"
  64. }
  65. ----
  66. // TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]