| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 | [role="xpack"][testenv="basic"][[rollup-get-rollup-index-caps]]=== Get rollup index capabilities API++++<titleabbrev>Get rollup index caps</titleabbrev>++++Returns the rollup capabilities of all jobs inside of a rollup index (e.g. theindex where rollup data is stored).experimental[][[rollup-get-rollup-index-caps-request]]==== {api-request-title}`GET <target>/_rollup/data`[[rollup-get-rollup-index-caps-prereqs]]==== {api-prereq-title}* If the {es} {security-features} are enabled, you must have the `read` indexprivilege on the index that stores the rollup results. For more information, see<<security-privileges>>.[[rollup-get-rollup-index-caps-desc]]==== {api-description-title}A single rollup index may store the data for multiple {rollup-jobs}, and mayhave a variety of capabilities depending on those jobs.This API will allow you to determine:1. What jobs are stored in an index (or indices specified via a pattern)?2. What target indices were rolled up, what fields were used in those rollupsand what aggregations can be performed on each job?[[rollup-get-rollup-index-caps-path-params]]==== {api-path-parms-title}`<target>`::(Required, string) Data stream or index to check for rollup capabilities.Wildcard (`*`) expressions are supported.[[rollup-get-rollup-index-caps-example]]==== {api-examples-title}Imagine we have an index named `sensor-1` full of raw data.  We know that thedata will grow over time, so there will be a `sensor-2`, `sensor-3`, etc. Let's create a {rollup-job} that stores its data in `sensor_rollup`:[source,console]--------------------------------------------------PUT _rollup/job/sensor{  "index_pattern": "sensor-*",  "rollup_index": "sensor_rollup",  "cron": "*/30 * * * * ?",  "page_size": 1000,  "groups": {    "date_histogram": {      "field": "timestamp",      "fixed_interval": "1h",      "delay": "7d"    },    "terms": {      "fields": [ "node" ]    }  },  "metrics": [    {      "field": "temperature",      "metrics": [ "min", "max", "sum" ]    },    {      "field": "voltage",      "metrics": [ "avg" ]    }  ]}--------------------------------------------------// TEST[setup:sensor_index]If at a later date, we'd like to determine what jobs and capabilities werestored in the `sensor_rollup` index, we can use the get rollup index API:[source,console]--------------------------------------------------GET /sensor_rollup/_rollup/data--------------------------------------------------// TEST[continued]Note how we are requesting the concrete rollup index name (`sensor_rollup`) asthe first part of the URL. This  will yield the following response:[source,console-result]----{  "sensor_rollup" : {    "rollup_jobs" : [      {        "job_id" : "sensor",        "rollup_index" : "sensor_rollup",        "index_pattern" : "sensor-*",        "fields" : {          "node" : [            {              "agg" : "terms"            }          ],          "temperature" : [            {              "agg" : "min"            },            {              "agg" : "max"            },            {              "agg" : "sum"            }          ],          "timestamp" : [            {              "agg" : "date_histogram",              "time_zone" : "UTC",              "fixed_interval" : "1h",              "delay": "7d"            }          ],          "voltage" : [            {              "agg" : "avg"            }          ]        }      }    ]  }}----The response that is returned contains information that is similar to theoriginal rollup configuration, but formatted differently. First, there are somehouse-keeping details: the {rollup-job} ID, the index that holds the rolled data,the index pattern that the job was targeting.Next it shows a list of fields that contain data eligible for rollup searches. Here we see four fields: `node`, `temperature`, `timestamp` and `voltage`. Eachof these fields list the aggregations that are possible. For example, you canuse a min, max, or sum aggregation on the `temperature` field, but only a`date_histogram` on `timestamp`.Note that the `rollup_jobs` element is an array; there can be multiple,independent jobs configured for a single index or index pattern. Each of thesejobs may have different configurations, so the API returns a list of all thevarious configurations available.Like other APIs that interact with indices, you can specify index patternsinstead of explicit indices:[source,console]--------------------------------------------------GET /*_rollup/_rollup/data--------------------------------------------------// TEST[continued]
 |