1
0

rollup-index-caps.asciidoc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. ifdef::permanently-unreleased-branch[]
  2. [role="xpack"]
  3. [testenv="basic"]
  4. [[rollup-get-rollup-index-caps]]
  5. === Get legacy rollup index capabilities API
  6. ++++
  7. <titleabbrev>Get legacy rollup index caps</titleabbrev>
  8. ++++
  9. include::put-job.asciidoc[tag=legacy-rollup-admon]
  10. Returns the capabilities of rollup jobs for a legacy rollup index.
  11. endif::[]
  12. ifndef::permanently-unreleased-branch[]
  13. [role="xpack"]
  14. [testenv="basic"]
  15. [[rollup-get-rollup-index-caps]]
  16. === Get rollup index capabilities API
  17. ++++
  18. <titleabbrev>Get rollup index caps</titleabbrev>
  19. ++++
  20. Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the
  21. index where rollup data is stored).
  22. experimental[]
  23. endif::[]
  24. [[rollup-get-rollup-index-caps-request]]
  25. ==== {api-request-title}
  26. `GET <target>/_rollup/data`
  27. [[rollup-get-rollup-index-caps-prereqs]]
  28. ==== {api-prereq-title}
  29. * If the {es} {security-features} are enabled, you must have the `read` index
  30. privilege on the index that stores the rollup results. For more information, see
  31. <<security-privileges>>.
  32. [[rollup-get-rollup-index-caps-desc]]
  33. ==== {api-description-title}
  34. A single rollup index may store the data for multiple {rollup-jobs}, and may
  35. have a variety of capabilities depending on those jobs.
  36. This API will allow you to determine:
  37. 1. What jobs are stored in an index (or indices specified via a pattern)?
  38. 2. What target indices were rolled up, what fields were used in those rollups
  39. and what aggregations can be performed on each job?
  40. [[rollup-get-rollup-index-caps-path-params]]
  41. ==== {api-path-parms-title}
  42. `<target>`::
  43. (Required, string) Data stream or index to check for rollup capabilities.
  44. Wildcard (`*`) expressions are supported.
  45. [[rollup-get-rollup-index-caps-example]]
  46. ==== {api-examples-title}
  47. Imagine we have an index named `sensor-1` full of raw data. We know that the
  48. data will grow over time, so there will be a `sensor-2`, `sensor-3`, etc.
  49. Let's create a {rollup-job} that stores its data in `sensor_rollup`:
  50. [source,console]
  51. --------------------------------------------------
  52. PUT _rollup/job/sensor
  53. {
  54. "index_pattern": "sensor-*",
  55. "rollup_index": "sensor_rollup",
  56. "cron": "*/30 * * * * ?",
  57. "page_size": 1000,
  58. "groups": {
  59. "date_histogram": {
  60. "field": "timestamp",
  61. "fixed_interval": "1h",
  62. "delay": "7d"
  63. },
  64. "terms": {
  65. "fields": [ "node" ]
  66. }
  67. },
  68. "metrics": [
  69. {
  70. "field": "temperature",
  71. "metrics": [ "min", "max", "sum" ]
  72. },
  73. {
  74. "field": "voltage",
  75. "metrics": [ "avg" ]
  76. }
  77. ]
  78. }
  79. --------------------------------------------------
  80. // TEST[setup:sensor_index]
  81. If at a later date, we'd like to determine what jobs and capabilities were
  82. stored in the `sensor_rollup` index, we can use the get rollup index API:
  83. [source,console]
  84. --------------------------------------------------
  85. GET /sensor_rollup/_rollup/data
  86. --------------------------------------------------
  87. // TEST[continued]
  88. Note how we are requesting the concrete rollup index name (`sensor_rollup`) as
  89. the first part of the URL. This will yield the following response:
  90. [source,console-result]
  91. ----
  92. {
  93. "sensor_rollup" : {
  94. "rollup_jobs" : [
  95. {
  96. "job_id" : "sensor",
  97. "rollup_index" : "sensor_rollup",
  98. "index_pattern" : "sensor-*",
  99. "fields" : {
  100. "node" : [
  101. {
  102. "agg" : "terms"
  103. }
  104. ],
  105. "temperature" : [
  106. {
  107. "agg" : "min"
  108. },
  109. {
  110. "agg" : "max"
  111. },
  112. {
  113. "agg" : "sum"
  114. }
  115. ],
  116. "timestamp" : [
  117. {
  118. "agg" : "date_histogram",
  119. "time_zone" : "UTC",
  120. "fixed_interval" : "1h",
  121. "delay": "7d"
  122. }
  123. ],
  124. "voltage" : [
  125. {
  126. "agg" : "avg"
  127. }
  128. ]
  129. }
  130. }
  131. ]
  132. }
  133. }
  134. ----
  135. The response that is returned contains information that is similar to the
  136. original rollup configuration, but formatted differently. First, there are some
  137. house-keeping details: the {rollup-job} ID, the index that holds the rolled data,
  138. the index pattern that the job was targeting.
  139. Next it shows a list of fields that contain data eligible for rollup searches.
  140. Here we see four fields: `node`, `temperature`, `timestamp` and `voltage`. Each
  141. of these fields list the aggregations that are possible. For example, you can
  142. use a min, max, or sum aggregation on the `temperature` field, but only a
  143. `date_histogram` on `timestamp`.
  144. Note that the `rollup_jobs` element is an array; there can be multiple,
  145. independent jobs configured for a single index or index pattern. Each of these
  146. jobs may have different configurations, so the API returns a list of all the
  147. various configurations available.
  148. Like other APIs that interact with indices, you can specify index patterns
  149. instead of explicit indices:
  150. [source,console]
  151. --------------------------------------------------
  152. GET /*_rollup/_rollup/data
  153. --------------------------------------------------
  154. // TEST[continued]