Get rollup jobs API
editGet rollup jobs API
editThis functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
This API returns the configuration, stats and status of rollup jobs. The API can return the details for a single job, or for all jobs.
Note: This API only returns active (both STARTED and STOPPED) jobs. If a job was created, ran for a while then deleted,
this API will not return any details about that job.
For details about a historical job, the Rollup Capabilities API may be more useful
Request
editGET _xpack/rollup/job/<job_id>
Path Parameters
edit-
job_id -
(string) Identifier for the job to retrieve. If omitted (or
_allis used) all jobs will be returned
Request Body
editThere is no request body for the Get Jobs API.
Authorization
editYou must have monitor, monitor_rollup, manage or manage_rollup cluster privileges to use this API.
For more information, see
Security privileges.
Examples
editIf we have already created a rollup job named sensor, the details about the job can be retrieved with:
GET _xpack/rollup/job/sensor
Which will yield the following response:
{
"jobs" : [
{
"config" : {
"id" : "sensor",
"index_pattern" : "sensor-*",
"rollup_index" : "sensor_rollup",
"cron" : "*/30 * * * * ?",
"groups" : {
"date_histogram" : {
"interval" : "1h",
"delay": "7d",
"field": "timestamp",
"time_zone": "UTC"
},
"terms" : {
"fields" : [
"node"
]
}
},
"metrics" : [
{
"field" : "temperature",
"metrics" : [
"min",
"max",
"sum"
]
},
{
"field" : "voltage",
"metrics" : [
"avg"
]
}
],
"timeout" : "20s",
"page_size" : 1000
},
"status" : {
"job_state" : "stopped",
"upgraded_doc_id": true
},
"stats" : {
"pages_processed" : 0,
"documents_processed" : 0,
"rollups_indexed" : 0,
"trigger_count" : 0
}
}
]
}
The jobs array contains a single job (id: sensor) since we requested a single job in the endpoint’s URL. The
details for this job contain three top-level parameters: config, status and stats
config holds the rollup job’s configuration, which is identical to the configuration that was supplied when creating
the job via the Create Job API.
The status object holds the current status of the rollup job’s indexer. The possible values and their meanings are:
-
stoppedmeans the indexer is paused and will not process data, even if it’s cron interval triggers -
startedmeans the indexer is running, but not actively indexing data. When the cron interval triggers, the job’s indexer will begin to process data -
indexingmeans the indexer is actively processing data and creating new rollup documents. When in this state, any subsequent cron interval triggers will be ignored because the job is already active with the prior trigger -
aborta transient state, which is usually not witnessed by the user. Theabortstate is used if the task needs to be shut down for some reason (job has been deleted, an unrecoverable error has been encountered, etc). Shortly after theabortstate is set, the job will remove itself from the cluster
Finally, the stats object provides transient statistics about the rollup job, such as how many documents have been
processed and how many rollup summary docs have been indexed. These stats are not persisted, so if a node is restarted
these stats will be reset.
If we add another job, we can see how multi-job responses are handled:
PUT _xpack/rollup/job/sensor2 { "index_pattern": "sensor-*", "rollup_index": "sensor_rollup", "cron": "*/30 * * * * ?", "page_size" :1000, "groups" : { "date_histogram": { "field": "timestamp", "interval": "1h", "delay": "7d" }, "terms": { "fields": ["node"] } }, "metrics": [ { "field": "temperature", "metrics": ["min", "max", "sum"] }, { "field": "voltage", "metrics": ["avg"] } ] } GET _xpack/rollup/job/_all
Which will yield the following response:
{
"jobs" : [
{
"config" : {
"id" : "sensor2",
"index_pattern" : "sensor-*",
"rollup_index" : "sensor_rollup",
"cron" : "*/30 * * * * ?",
"groups" : {
"date_histogram" : {
"interval" : "1h",
"delay": "7d",
"field": "timestamp",
"time_zone": "UTC"
},
"terms" : {
"fields" : [
"node"
]
}
},
"metrics" : [
{
"field" : "temperature",
"metrics" : [
"min",
"max",
"sum"
]
},
{
"field" : "voltage",
"metrics" : [
"avg"
]
}
],
"timeout" : "20s",
"page_size" : 1000
},
"status" : {
"job_state" : "stopped",
"upgraded_doc_id": true
},
"stats" : {
"pages_processed" : 0,
"documents_processed" : 0,
"rollups_indexed" : 0,
"trigger_count" : 0
}
},
{
"config" : {
"id" : "sensor",
"index_pattern" : "sensor-*",
"rollup_index" : "sensor_rollup",
"cron" : "*/30 * * * * ?",
"groups" : {
"date_histogram" : {
"interval" : "1h",
"delay": "7d",
"field": "timestamp",
"time_zone": "UTC"
},
"terms" : {
"fields" : [
"node"
]
}
},
"metrics" : [
{
"field" : "temperature",
"metrics" : [
"min",
"max",
"sum"
]
},
{
"field" : "voltage",
"metrics" : [
"avg"
]
}
],
"timeout" : "20s",
"page_size" : 1000
},
"status" : {
"job_state" : "stopped",
"upgraded_doc_id": true
},
"stats" : {
"pages_processed" : 0,
"documents_processed" : 0,
"rollups_indexed" : 0,
"trigger_count" : 0
}
}
]
}