elasticsearch/docs/reference/ml/anomaly-detection/apis/reset-job.asciidoc
James Rodewig f56a0f4b66
[DOCS] Remove testenv annotations from doc snippet tests (#80023)
Removes `testenv` annotations and related code. These annotations originally let you skip x-pack snippet tests in the docs. However, that's no longer possible.

Relates to #79309, #31619
2021-11-05 18:38:50 -04:00

85 lines
2.2 KiB
Text

[role="xpack"]
[[ml-reset-job]]
= Reset {anomaly-jobs} API
++++
<titleabbrev>Reset jobs</titleabbrev>
++++
Resets an existing {anomaly-job}.
[[ml-reset-job-request]]
== {api-request-title}
`POST _ml/anomaly_detectors/<job_id>/_reset`
[[ml-reset-job-prereqs]]
== {api-prereq-title}
* Requires the `manage_ml` cluster privilege. This privilege is included in the
`machine_learning_admin` built-in role.
* Before you can reset a job, you must close it. You can set `force` to `true`
when closing the job to avoid waiting for the job to complete. See
<<ml-close-job>>.
[[ml-reset-job-desc]]
== {api-description-title}
All model state and results are deleted.
The job is ready to start over as if it had just been created.
It is not currently possible to reset multiple jobs using wildcards or a comma
separated list.
[[ml-reset-job-path-parms]]
== {api-path-parms-title}
`<job_id>`::
(Required, string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
[[ml-reset-job-query-parms]]
== {api-query-parms-title}
`wait_for_completion`::
(Optional, Boolean) Specifies whether the request should return immediately or
wait until the job reset completes. Defaults to `true`.
[[ml-reset-job-example]]
== {api-examples-title}
[source,console]
--------------------------------------------------
POST _ml/anomaly_detectors/total-requests/_reset
--------------------------------------------------
// TEST[skip:setup:server_metrics_job]
When the job is reset, you receive the following results:
[source,console-result]
----
{
"acknowledged": true
}
----
In the next example we reset the `total-requests` job asynchronously:
[source,console]
--------------------------------------------------
POST _ml/anomaly_detectors/total-requests/_reset?wait_for_completion=false
--------------------------------------------------
// TEST[skip:setup:server_metrics_job]
When `wait_for_completion` is set to `false`, the response contains the id
of the job reset task:
[source,console-result]
----
{
"task": "oTUltX4IQMOUUVeiohTt8A:39"
}
----
// TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]
If you want to check the status of the reset task, use the <<tasks>> by referencing
the task ID.