Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/reference/rest-api/defs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ These resource definitions are used in APIs related to {ml-features} and
* <<data-frame-transform-pivot,Pivots>>
* <<ml-results-resource,Results>>
* <<role-mapping-resources,Role mappings>>
* <<rollup-job-objects,Rollup jobs>>
* <<ml-event-resource,Scheduled Events>>

include::{es-repo-dir}/ml/apis/calendarresource.asciidoc[]
Expand All @@ -25,5 +26,6 @@ include::{es-repo-dir}/ml/apis/jobcounts.asciidoc[]
include::{es-repo-dir}/ml/apis/snapshotresource.asciidoc[]
include::{es-repo-dir}/data-frames/apis/pivotresource.asciidoc[]
include::{xes-repo-dir}/rest-api/security/role-mapping-resources.asciidoc[]
include::{es-repo-dir}/rollup/apis/rollup-jobs-objects.asciidoc[]
include::{es-repo-dir}/ml/apis/resultsresource.asciidoc[]
include::{es-repo-dir}/ml/apis/eventresource.asciidoc[]
112 changes: 45 additions & 67 deletions docs/reference/rollup/apis/delete-job.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,45 @@
<titleabbrev>Delete job</titleabbrev>
++++

Deletes an existing rollup job.

experimental[]

This API deletes an existing rollup job. A job must be *stopped* first before it can be deleted. Attempting to delete
a started job will result in an error. Similarly, attempting to delete a nonexistent job will throw an exception.
[float]
[[rollup-delete-job-request]]
==== {api-request-title}

`DELETE _rollup/job/<job_id>`

[float]
[[rollup-delete-job-prereqs]]
==== {api-prereq-title}

.Deleting the job does not delete rolled up data
**********************************
When a job is deleted, that only removes the process that is actively monitoring and rolling up data.
It does not delete any previously rolled up data. This is by design; a user may wish to roll up a static dataset. Because
the dataset is static, once it has been fully rolled up there is no need to keep the indexing Rollup job around (as there
will be no new data). So the job may be deleted, leaving behind the rolled up data for analysis.
If the {es} {security-features} are enabled, you must have `manage` or
`manage_rollup` cluster privileges to use this API. For more information, see
{stack-ov}/security-privileges.html[Security privileges].

If you wish to also remove the rollup data, and the rollup index only contains the data for a single job, you can simply
delete the whole rollup index. If the rollup index stores data from several jobs, you must issue a Delete-By-Query that
targets the Rollup job's ID in the rollup index:
[float]
[[rollup-delete-job-desc]]
==== {api-description-title}

A job must be *stopped* first before it can be deleted. If you attempt to delete
a started job, an error occurs. Similarly, if you attempt to delete a
nonexistent job, an exception occurs.

[IMPORTANT]
===============================
When a job is deleted, that only removes the process that is actively monitoring
and rolling up data. It does not delete any previously rolled up data. This is
by design; a user may wish to roll up a static dataset. Because the dataset is
static, once it has been fully rolled up there is no need to keep the indexing
rollup job around (as there will be no new data). So the job can be deleted,
leaving behind the rolled up data for analysis.

If you wish to also remove the rollup data, and the rollup index only contains
the data for a single job, you can simply delete the whole rollup index. If the
rollup index stores data from several jobs, you must issue a delete-by-query
that targets the rollup job's ID in the rollup index.

[source,js]
--------------------------------------------------
Expand All @@ -35,34 +58,20 @@ POST my_rollup_index/_delete_by_query
}
--------------------------------------------------
// NOTCONSOLE
===============================

**********************************
==== Request

`DELETE _rollup/job/<job_id>`

//===== Description

==== Path Parameters

`job_id` (required)::
(string) Identifier for the job


==== Request Body

There is no request body for the Delete Job API.

==== Authorization
[float]
[[rollup-delete-job-path-params]]
==== {api-path-parms-title}

You must have `manage` or `manage_rollup` cluster privileges to use this API.
For more information, see
{xpack-ref}/security-privileges.html[Security Privileges].
`<job_id>` (Required)::
(string) Identifier for the job.

[float]
[[rollup-delete-job-example]]
==== {api-example-title}

==== Examples

If we have a rollup job named `sensor`, it can be deleted with:
If you have a rollup job named `sensor`, you can delete it as follows:

[source,js]
--------------------------------------------------
Expand All @@ -71,7 +80,7 @@ DELETE _rollup/job/sensor
// CONSOLE
// TEST[setup:sensor_rollup_job]

Which will return the response:
The API returns the following response:

[source,js]
----
Expand All @@ -80,34 +89,3 @@ Which will return the response:
}
----
// TESTRESPONSE

If however we try to delete a job which doesn't exist:

[source,js]
--------------------------------------------------
DELETE _rollup/job/does_not_exist
--------------------------------------------------
// CONSOLE
// TEST[catch:missing]

A 404 `resource_not_found` exception will be thrown:

[source,js]
----
{
"error" : {
"root_cause" : [
{
"type" : "resource_not_found_exception",
"reason" : "the task with id [does_not_exist] doesn't exist",
"stack_trace": ...
}
],
"type" : "resource_not_found_exception",
"reason" : "the task with id [does_not_exist] doesn't exist",
"stack_trace": ...
},
"status": 404
}
----
// TESTRESPONSE[s/"stack_trace": .../"stack_trace": $body.$_path/]
Loading