reset-job.asciidoc 2.2 KB

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