2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2018-08-31 19:49:24 -04:00
|
|
|
[testenv="platinum"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-delete-job]]
|
2020-07-20 16:10:54 -04:00
|
|
|
= Delete {anomaly-jobs} API
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Delete jobs</titleabbrev>
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-25 11:58:16 -04:00
|
|
|
Deletes an existing {anomaly-job}.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-job-request]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-request-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`DELETE _ml/anomaly_detectors/<job_id>`
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-delete-job-prereqs]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-prereq-title}
|
2019-06-27 16:58:42 -04:00
|
|
|
|
|
|
|
* If {es} {security-features} are enabled, you must have `manage_ml` or `manage`
|
2019-10-07 18:23:19 -04:00
|
|
|
cluster privileges to use this API. See <<security-privileges>>.
|
2019-11-19 11:31:24 -05:00
|
|
|
* Before you can delete a job, you must delete the {dfeeds} that are associated
|
|
|
|
with it. See <<ml-delete-datafeed>>.
|
|
|
|
* Before you can delete a job, you must close it (unless you specify the `force` parameter). See <<ml-close-job>>.
|
2019-06-27 16:58:42 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-job-desc]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-description-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
All job configuration, model state and results are deleted.
|
|
|
|
|
2019-07-25 11:58:16 -04:00
|
|
|
IMPORTANT: Deleting an {anomaly-job} must be done via this API only. Do not
|
|
|
|
delete the job directly from the `.ml-*` indices using the {es} delete document
|
2018-12-19 17:53:37 -05:00
|
|
|
API. When {es} {security-features} are enabled, make sure no `write` privileges
|
|
|
|
are granted to anyone over the `.ml-*` indices.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
It is not currently possible to delete multiple jobs using wildcards or a comma
|
|
|
|
separated list.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-job-path-parms]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-path-parms-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<job_id>`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Required, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
|
2017-04-11 21:52:47 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-job-query-parms]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-query-parms-title}
|
2017-06-06 04:41:33 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`force`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, boolean) Use to forcefully delete an opened job; this method is
|
|
|
|
quicker than closing and deleting the job.
|
2017-06-06 04:41:33 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`wait_for_completion`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, boolean) Specifies whether the request should return immediately or
|
|
|
|
wait until the job deletion completes. Defaults to `true`.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-job-example]]
|
2020-07-20 16:10:54 -04:00
|
|
|
== {api-examples-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
DELETE _ml/anomaly_detectors/total-requests
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
2018-08-31 19:49:24 -04:00
|
|
|
// TEST[skip:setup:server_metrics_job]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
When the job is deleted, you receive the following results:
|
2019-09-06 09:22:08 -04:00
|
|
|
|
|
|
|
[source,console-result]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"acknowledged": true
|
|
|
|
}
|
|
|
|
----
|
2018-10-04 19:41:28 -04:00
|
|
|
|
|
|
|
In the next example we delete the `total-requests` job asynchronously:
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2018-10-04 19:41:28 -04:00
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
DELETE _ml/anomaly_detectors/total-requests?wait_for_completion=false
|
2018-10-04 19:41:28 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[skip:setup:server_metrics_job]
|
|
|
|
|
|
|
|
When `wait_for_completion` is set to `false`, the response contains the id
|
|
|
|
of the job deletion task:
|
2019-09-06 16:09:09 -04:00
|
|
|
|
|
|
|
[source,console-result]
|
2018-10-04 19:41:28 -04:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"task": "oTUltX4IQMOUUVeiohTt8A:39"
|
|
|
|
}
|
|
|
|
----
|
2018-12-07 15:34:11 -05:00
|
|
|
// TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]
|