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]]
|
2017-12-14 13:52:49 -05:00
|
|
|
=== Delete Jobs API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Delete Jobs</titleabbrev>
|
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-06-13 16:37:35 -04:00
|
|
|
Deletes an existing anomaly detection job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Request
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`DELETE _xpack/ml/anomaly_detectors/<job_id>`
|
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Description
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
All job configuration, model state and results are deleted.
|
|
|
|
|
|
|
|
IMPORTANT: Deleting a job must be done via this API only. Do not delete the
|
|
|
|
job directly from the `.ml-*` indices using the Elasticsearch
|
|
|
|
DELETE Document API. When {security} is enabled, make sure no `write`
|
|
|
|
privileges are granted to anyone over the `.ml-*` indices.
|
|
|
|
|
2017-05-02 15:45:42 -04:00
|
|
|
Before you can delete a job, you must delete the {dfeeds} that are associated
|
2017-06-06 04:41:33 -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
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Path Parameters
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`job_id` (required)::
|
2017-05-02 15:45:42 -04:00
|
|
|
(string) Identifier for the job
|
2017-04-11 21:52:47 -04:00
|
|
|
|
2017-06-06 04:41:33 -04:00
|
|
|
===== Query Parameters
|
|
|
|
|
|
|
|
`force`::
|
|
|
|
(boolean) Use to forcefully delete an opened job; this method is quicker than
|
|
|
|
closing and deleting the job.
|
|
|
|
|
2018-10-04 19:41:28 -04:00
|
|
|
`wait_for_completion`::
|
|
|
|
(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
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Authorization
|
2017-04-25 17:08:29 -04:00
|
|
|
|
|
|
|
You must have `manage_ml`, or `manage` cluster privileges to use this API.
|
2017-06-19 21:23:58 -04:00
|
|
|
For more information, see {xpack-ref}/security-privileges.html[Security Privileges].
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Examples
|
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-02-09 12:16:24 -05:00
|
|
|
DELETE _xpack/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]
|
|
|
|
--------------------------------------------------
|
|
|
|
DELETE _xpack/ml/anomaly_detectors/total-requests?wait_for_completion=false
|
|
|
|
--------------------------------------------------
|
|
|
|
// 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"
|
|
|
|
}
|
|
|
|
----
|
|
|
|
// TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]
|