OpenSearch/docs/en/rest-api/rollup/put-job.asciidoc
Zachary Tong bf1550a0b2 Rollups for Elasticsearch (elastic/x-pack-elasticsearch#4002)
This adds a new Rollup module to XPack, which allows users to configure periodic "rollup jobs" to pre-aggregate data.  That data is then available later for search through a special RollupSearch API, which mimics the DSL and functionality of regular search.

Rollups are used to drastically reduce the on-disk footprint of metric-based data (e.g. timestamped document with numeric and keyword fields).  It can also be used to speed up aggregations over large datasets, since the rolled data will be considerably smaller and fewer documents to search.

The PR adds seven new endpoints to interact with Rollups; create/get/delete job, start/stop job, a capabilities API similar to field-caps, and a Rollup-enabled search.

Original commit: elastic/x-pack-elasticsearch@dcde91aacf
2018-02-23 17:10:37 -05:00

95 lines
2.4 KiB
Plaintext

[role="xpack"]
[[rollup-put-job]]
=== Create Job API
++++
<titleabbrev>Create Job</titleabbrev>
++++
This API enables you to create a rollup job. The job will be created in a `STOPPED` state, and must be
started with the <<rollup-start-job,Start Job API>>.
==== Request
`PUT _xpack/rollup/job/<job_id>`
//===== Description
==== Path Parameters
`job_id` (required)::
(string) Identifier for the job
==== Request Body
`index_pattern` (required)::
(string) The index, or index pattern, that you wish to rollup. Supports wildcard-style patterns (`logstash-*`).
`rollup_index` (required)::
(string) The index that you wish to store rollup results into. Can be shared with other rollup jobs.
`cron` (required)::
(string) A cron string which defines when the rollup job should be executed.
`size` (required)::
(int) The number of bucket results that should be processed on each iteration of the rollup indexer. A larger value
will tend to execute faster, but will require more memory during processing.
`groups` (required)::
(object) Defines the grouping fields that are defined for this rollup job. See <<rollup-job-config,rollup job config>>.
`metrics`::
(object) Defines the metrics that should be collected for each grouping tuple. See <<rollup-job-config,rollup job config>>.
==== 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
The following example creates a rollup job named "sensor", targeting the "sensor-*" index pattern:
[source,js]
--------------------------------------------------
PUT _xpack/rollup/job/sensor
{
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "*/30 * * * * ?",
"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"]
}
]
}
--------------------------------------------------
// CONSOLE
When the job is created, you receive the following results:
[source,js]
----
{
"acknowledged": true
}
----
// TESTRESPONSE