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]]
|
2019-07-25 11:58:16 -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]]
|
|
|
|
==== {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]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If {es} {security-features} are enabled, you must have `manage_ml` or `manage`
|
|
|
|
cluster privileges to use this API. See
|
|
|
|
{stack-ov}/security-privileges.html[Security privileges].
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-job-desc]]
|
|
|
|
==== {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-05-02 15:45:42 -04:00
|
|
|
Before you can delete a job, you must delete the {dfeeds} that are associated
|
2019-07-25 11:58:16 -04:00
|
|
|
with it. See <<ml-delete-datafeed,Delete {dfeeds-cap}>>. Unless the `force`
|
|
|
|
parameter is used the job must be closed before it can be deleted.
|
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]]
|
|
|
|
==== {api-path-parms-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<job_id>`::
|
2019-07-25 11:58:16 -04:00
|
|
|
(Required, string) Identifier for the {anomaly-job}.
|
2017-04-11 21:52:47 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-job-query-parms]]
|
|
|
|
==== {api-query-parms-title}
|
2017-06-06 04:41:33 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`force`::
|
|
|
|
(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`::
|
|
|
|
(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]]
|
|
|
|
==== {api-examples-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-02-09 12:16:24 -05:00
|
|
|
The following example deletes the `total-requests` job:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
DELETE _ml/anomaly_detectors/total-requests
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
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:
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"acknowledged": true
|
|
|
|
}
|
|
|
|
----
|
2018-10-04 19:41:28 -04:00
|
|
|
// TESTRESPONSE
|
|
|
|
|
|
|
|
In the next example we delete the `total-requests` job asynchronously:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
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
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:setup:server_metrics_job]
|
|
|
|
|
|
|
|
When `wait_for_completion` is set to `false`, the response contains the id
|
|
|
|
of the job deletion task:
|
|
|
|
[source,js]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"task": "oTUltX4IQMOUUVeiohTt8A:39"
|
|
|
|
}
|
|
|
|
----
|
2018-12-07 15:34:11 -05:00
|
|
|
// TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]
|