2018-02-23 17:10:37 -05:00
|
|
|
[role="xpack"]
|
|
|
|
[[rollup-stop-job]]
|
|
|
|
=== Stop Job API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Stop Job</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
2018-06-13 15:42:20 -04:00
|
|
|
experimental[]
|
|
|
|
|
2018-02-23 17:10:37 -05:00
|
|
|
This API stops an existing, started rollup job. If the job does not exist an exception will be thrown.
|
|
|
|
Stopping an already stopped job has no action.
|
|
|
|
|
|
|
|
==== Request
|
|
|
|
|
|
|
|
`POST _xpack/rollup/job/<job_id>/_stop`
|
|
|
|
|
|
|
|
//===== Description
|
|
|
|
|
|
|
|
==== Path Parameters
|
|
|
|
|
|
|
|
`job_id` (required)::
|
|
|
|
(string) Identifier for the job
|
|
|
|
|
|
|
|
|
|
|
|
==== Request Body
|
|
|
|
|
|
|
|
There is no request body for the Stop Job API.
|
|
|
|
|
|
|
|
==== Authorization
|
|
|
|
|
|
|
|
You must have `manage` or `manage_rollup` cluster privileges to use this API.
|
|
|
|
For more information, see
|
|
|
|
{xpack-ref}/security-privileges.html[Security Privileges].
|
|
|
|
|
|
|
|
|
|
|
|
==== Examples
|
|
|
|
|
|
|
|
If we have an already-started rollup job named `sensor`, it can be stopped with:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
POST _xpack/rollup/job/sensor/_stop
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[setup:sensor_started_rollup_job]
|
|
|
|
|
|
|
|
Which will return the response:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"stopped": true
|
|
|
|
}
|
|
|
|
----
|
|
|
|
// TESTRESPONSE
|
|
|
|
|
|
|
|
If however we try to stop a job which doesn't exist:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
POST _xpack/rollup/job/does_not_exist/_stop
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[catch:missing]
|
|
|
|
|
|
|
|
A 404 `resource_not_found` exception will be thrown:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"error" : {
|
|
|
|
"root_cause" : [
|
|
|
|
{
|
|
|
|
"type" : "resource_not_found_exception",
|
|
|
|
"reason" : "Task for Rollup Job [does_not_exist] not found",
|
|
|
|
"stack_trace": ...
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"type" : "resource_not_found_exception",
|
|
|
|
"reason" : "Task for Rollup Job [does_not_exist] not found",
|
|
|
|
"stack_trace": ...
|
|
|
|
},
|
|
|
|
"status": 404
|
|
|
|
}
|
|
|
|
----
|
|
|
|
// TESTRESPONSE[s/"stack_trace": .../"stack_trace": $body.$_path/]
|