get-data-stream.asciidoc 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. [role="xpack"]
  2. [[indices-get-data-stream]]
  3. === Get data stream API
  4. ++++
  5. <titleabbrev>Get data stream</titleabbrev>
  6. ++++
  7. Retrieves information about one or more <<data-streams,data streams>>.
  8. See <<get-info-about-a-data-stream>>.
  9. ////
  10. [source,console]
  11. ----
  12. PUT /_ilm/policy/my-lifecycle-policy
  13. {
  14. "policy": {
  15. "phases": {
  16. "hot": {
  17. "actions": {
  18. "rollover": {
  19. "max_size": "25GB"
  20. }
  21. }
  22. },
  23. "delete": {
  24. "min_age": "30d",
  25. "actions": {
  26. "delete": {}
  27. }
  28. }
  29. }
  30. }
  31. }
  32. PUT /_index_template/my-index-template
  33. {
  34. "index_patterns": [ "my-data-stream*" ],
  35. "data_stream": {},
  36. "template": {
  37. "settings": {
  38. "index.lifecycle.name": "my-lifecycle-policy"
  39. }
  40. },
  41. "_meta": {
  42. "my-meta-field": "foo"
  43. }
  44. }
  45. PUT /_data_stream/my-data-stream
  46. POST /my-data-stream/_rollover
  47. PUT /_data_stream/my-data-stream-two
  48. ----
  49. // TESTSETUP
  50. ////
  51. ////
  52. [source,console]
  53. ----
  54. DELETE /_data_stream/*
  55. DELETE /_index_template/*
  56. DELETE /_ilm/policy/my-lifecycle-policy
  57. ----
  58. // TEARDOWN
  59. ////
  60. [source,console]
  61. ----
  62. GET /_data_stream/my-data-stream
  63. ----
  64. [[get-data-stream-api-request]]
  65. ==== {api-request-title}
  66. `GET /_data_stream/<data-stream>`
  67. [[get-data-stream-api-path-params]]
  68. ==== {api-path-parms-title}
  69. `<data-stream>`::
  70. (Optional, string)
  71. Comma-separated list of data stream names used to limit the request. Wildcard
  72. (`*`) expressions are supported. If omitted, all data streams will be
  73. returned.
  74. [role="child_attributes"]
  75. [[get-data-stream-api-query-parms]]
  76. ==== {api-query-parms-title}
  77. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=ds-expand-wildcards]
  78. +
  79. Defaults to `open`.
  80. [role="child_attributes"]
  81. [[get-data-stream-api-response-body]]
  82. ==== {api-response-body-title}
  83. `data_streams`::
  84. (array of objects)
  85. Contains information about retrieved data streams.
  86. +
  87. .Properties of objects in `data_streams`
  88. [%collapsible%open]
  89. ====
  90. `name`::
  91. (string)
  92. Name of the data stream.
  93. `timestamp_field`::
  94. (object)
  95. Contains information about the data stream's `@timestamp` field.
  96. +
  97. .Properties of `timestamp_field`
  98. [%collapsible%open]
  99. =====
  100. `name`::
  101. (string)
  102. Name of the data stream's timestamp field, which must be `@timestamp`. The
  103. `@timestamp` field must be included in every document indexed to the data
  104. stream.
  105. =====
  106. `indices`::
  107. (array of objects)
  108. Array of objects containing information about the data stream's backing
  109. indices.
  110. +
  111. The last item in this array contains information about the stream's current
  112. <<data-stream-write-index,write index>>.
  113. +
  114. .Properties of `indices` objects
  115. [%collapsible%open]
  116. =====
  117. `index_name`::
  118. (string)
  119. Name of the backing index. For naming conventions, see
  120. <<data-streams-generation>>.
  121. `index_uuid`::
  122. (string)
  123. Universally unique identifier (UUID) for the index.
  124. =====
  125. `generation`::
  126. (integer)
  127. Current <<data-streams-generation,generation>> for the data stream. This number
  128. acts as a cumulative count of the stream's rollovers, starting at `1`.
  129. `_meta`::
  130. (object)
  131. Custom metadata for the stream, copied from the `_meta` object of the
  132. stream's matching <<create-a-data-stream-template,index template>>. If empty,
  133. the response omits this property.
  134. `status`::
  135. (string)
  136. <<cluster-health,Health status>> of the data stream.
  137. +
  138. This health status is based on the state of the primary and replica shards of
  139. the stream's backing indices.
  140. +
  141. .Values for `status`
  142. [%collapsible%open]
  143. =====
  144. `green`:::
  145. All shards are assigned.
  146. `yellow`:::
  147. All primary shards are assigned, but one or more replica shards are
  148. unassigned.
  149. `red`:::
  150. One or more primary shards are unassigned, so some data is unavailable.
  151. =====
  152. `template`::
  153. (string)
  154. Name of the index template used to create the data stream's backing indices.
  155. +
  156. The template's index pattern must match the name of this data stream. See
  157. <<create-a-data-stream-template>>.
  158. `ilm_policy`::
  159. (string)
  160. Name of the current {ilm-init} lifecycle policy in the stream's matching index
  161. template. This lifecycle policy is set in the `index.lifecycle.name` setting.
  162. +
  163. If the template does not include a lifecycle policy, this property is not
  164. included in the response.
  165. +
  166. NOTE: A data stream's backing indices may be assigned different lifecycle
  167. policies. To retrieve the lifecycle policy for individual backing indices,
  168. use the <<indices-get-settings,get index settings API>>.
  169. `hidden`::
  170. (Boolean)
  171. If `true`, the data stream is <<hidden-indices,hidden>>.
  172. ====
  173. [[get-data-stream-api-example]]
  174. ==== {api-examples-title}
  175. [source,console]
  176. ----
  177. GET _data_stream/my-data-stream*
  178. ----
  179. The API returns the following response:
  180. [source,console-result]
  181. ----
  182. {
  183. "data_streams": [
  184. {
  185. "name": "my-data-stream",
  186. "timestamp_field": {
  187. "name": "@timestamp"
  188. },
  189. "indices": [
  190. {
  191. "index_name": ".ds-my-data-stream-2099.03.07-000001",
  192. "index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"
  193. },
  194. {
  195. "index_name": ".ds-my-data-stream-2099.03.08-000002",
  196. "index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"
  197. }
  198. ],
  199. "generation": 2,
  200. "_meta": {
  201. "my-meta-field": "foo"
  202. },
  203. "status": "GREEN",
  204. "template": "my-index-template",
  205. "ilm_policy": "my-lifecycle-policy",
  206. "hidden": false
  207. },
  208. {
  209. "name": "my-data-stream-two",
  210. "timestamp_field": {
  211. "name": "@timestamp"
  212. },
  213. "indices": [
  214. {
  215. "index_name": ".ds-my-data-stream-two-2099.03.08-000001",
  216. "index_uuid": "3liBu2SYS5axasRt6fUIpA"
  217. }
  218. ],
  219. "generation": 1,
  220. "_meta": {
  221. "my-meta-field": "foo"
  222. },
  223. "status": "YELLOW",
  224. "template": "my-index-template",
  225. "ilm_policy": "my-lifecycle-policy",
  226. "hidden": false
  227. }
  228. ]
  229. }
  230. ----
  231. // TESTRESPONSE[s/"index_name": ".ds-my-data-stream-2099.03.07-000001"/"index_name": $body.data_streams.0.indices.0.index_name/]
  232. // TESTRESPONSE[s/"index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"/"index_uuid": $body.data_streams.0.indices.0.index_uuid/]
  233. // TESTRESPONSE[s/"index_name": ".ds-my-data-stream-2099.03.08-000002"/"index_name": $body.data_streams.0.indices.1.index_name/]
  234. // TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
  235. // TESTRESPONSE[s/"index_name": ".ds-my-data-stream-two-2099.03.08-000001"/"index_name": $body.data_streams.1.indices.0.index_name/]
  236. // TESTRESPONSE[s/"index_uuid": "3liBu2SYS5axasRt6fUIpA"/"index_uuid": $body.data_streams.1.indices.0.index_uuid/]
  237. // TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW"/]