reset-job.asciidoc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. [role="xpack"]
  2. [[ml-reset-job]]
  3. = Reset {anomaly-jobs} API
  4. ++++
  5. <titleabbrev>Reset jobs</titleabbrev>
  6. ++++
  7. Resets an existing {anomaly-job}.
  8. [[ml-reset-job-request]]
  9. == {api-request-title}
  10. `POST _ml/anomaly_detectors/<job_id>/_reset`
  11. [[ml-reset-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 reset a job, you must close it. You can set `force` to `true`
  16. when closing the job to avoid waiting for the job to complete. See
  17. <<ml-close-job>>.
  18. [[ml-reset-job-desc]]
  19. == {api-description-title}
  20. All model state and results are deleted.
  21. The job is ready to start over as if it had just been created.
  22. It is not currently possible to reset multiple jobs using wildcards or a comma
  23. separated list.
  24. [[ml-reset-job-path-parms]]
  25. == {api-path-parms-title}
  26. `<job_id>`::
  27. (Required, string)
  28. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  29. [[ml-reset-job-query-parms]]
  30. == {api-query-parms-title}
  31. `wait_for_completion`::
  32. (Optional, Boolean) Specifies whether the request should return immediately or
  33. wait until the job reset completes. Defaults to `true`.
  34. [[ml-reset-job-example]]
  35. == {api-examples-title}
  36. [source,console]
  37. --------------------------------------------------
  38. POST _ml/anomaly_detectors/total-requests/_reset
  39. --------------------------------------------------
  40. // TEST[skip:setup:server_metrics_job]
  41. When the job is reset, you receive the following results:
  42. [source,console-result]
  43. ----
  44. {
  45. "acknowledged": true
  46. }
  47. ----
  48. In the next example we reset the `total-requests` job asynchronously:
  49. [source,console]
  50. --------------------------------------------------
  51. POST _ml/anomaly_detectors/total-requests/_reset?wait_for_completion=false
  52. --------------------------------------------------
  53. // TEST[skip:setup:server_metrics_job]
  54. When `wait_for_completion` is set to `false`, the response contains the id
  55. of the job reset task:
  56. [source,console-result]
  57. ----
  58. {
  59. "task": "oTUltX4IQMOUUVeiohTt8A:39"
  60. }
  61. ----
  62. // TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]
  63. If you want to check the status of the reset task, use the <<tasks>> by referencing
  64. the task ID.