Reset anomaly detection jobs API
Resets an existing anomaly detection job.
Request
POST _ml/anomaly_detectors/<job_id>/_reset
Prerequisites
- Requires the
manage_mlcluster privilege. This privilege is included in themachine_learning_adminbuilt-in role. - Before you can reset a job, you must close it. You can set
forcetotruewhen closing the job to avoid waiting for the job to complete. See Close jobs.
Description
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.
Path parameters
-
<job_id> - (Required, string) Identifier for the anomaly detection job.
Query parameters
-
wait_for_completion - (Optional, Boolean) Specifies whether the request should return immediately or wait until the job reset completes. Defaults to
true. -
delete_user_annotations - (Optional, Boolean) Specifies whether annotations that have been added by the user should be deleted along with any auto-generated annotations when the job is reset. Defaults to
false.
Examples
resp = client.ml.reset_job(
job_id="total-requests",
)
print(resp) response = client.ml.reset_job( job_id: 'total-requests' ) puts response
const response = await client.ml.resetJob({
job_id: "total-requests",
});
console.log(response); POST _ml/anomaly_detectors/total-requests/_reset
When the job is reset, you receive the following results:
{
"acknowledged": true
} In the next example we reset the total-requests job asynchronously:
resp = client.ml.reset_job(
job_id="total-requests",
wait_for_completion=False,
)
print(resp) response = client.ml.reset_job( job_id: 'total-requests', wait_for_completion: false ) puts response
const response = await client.ml.resetJob({
job_id: "total-requests",
wait_for_completion: "false",
});
console.log(response); POST _ml/anomaly_detectors/total-requests/_reset?wait_for_completion=false
When wait_for_completion is set to false, the response contains the id of the job reset task:
{
"task": "oTUltX4IQMOUUVeiohTt8A:39"
} If you want to check the status of the reset task, use the Task management by referencing the task ID.
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/ml-reset-job.html