get-data-stream.asciidoc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. }
  42. PUT /_data_stream/my-data-stream
  43. POST /my-data-stream/_rollover
  44. PUT /_data_stream/my-data-stream_two
  45. ----
  46. // TESTSETUP
  47. ////
  48. ////
  49. [source,console]
  50. ----
  51. DELETE /_data_stream/*
  52. DELETE /_index_template/*
  53. DELETE /_ilm/policy/my-lifecycle-policy
  54. ----
  55. // TEARDOWN
  56. ////
  57. [source,console]
  58. ----
  59. GET /_data_stream/my-data-stream
  60. ----
  61. [[get-data-stream-api-request]]
  62. ==== {api-request-title}
  63. `GET /_data_stream/<data-stream>`
  64. [[get-data-stream-api-path-params]]
  65. ==== {api-path-parms-title}
  66. `<data-stream>`::
  67. (Optional, string)
  68. Comma-separated list of data stream names used to limit the request. Wildcard
  69. (`*`) expressions are supported. If omitted, all data streams will be
  70. returned.
  71. [role="child_attributes"]
  72. [[get-data-stream-api-response-body]]
  73. ==== {api-response-body-title}
  74. `data_streams`::
  75. (array of objects)
  76. Contains information about retrieved data streams.
  77. +
  78. .Properties of objects in `data_streams`
  79. [%collapsible%open]
  80. ====
  81. `name`::
  82. (string)
  83. Name of the data stream.
  84. `timestamp_field`::
  85. (object)
  86. Contains information about the data stream's `@timestamp` field.
  87. +
  88. .Properties of `timestamp_field`
  89. [%collapsible%open]
  90. =====
  91. `name`::
  92. (string)
  93. Name of the data stream's timestamp field, which must be `@timestamp`. The
  94. `@timestamp` field must be included in every document indexed to the data
  95. stream.
  96. =====
  97. `indices`::
  98. (array of objects)
  99. Array of objects containing information about the data stream's backing
  100. indices.
  101. +
  102. The last item in this array contains information about the stream's current
  103. <<data-stream-write-index,write index>>.
  104. +
  105. .Properties of `indices` objects
  106. [%collapsible%open]
  107. =====
  108. `index_name`::
  109. (string)
  110. Name of the backing index. For naming conventions, see
  111. <<data-streams-generation>>.
  112. `index_uuid`::
  113. (string)
  114. Universally unique identifier (UUID) for the index.
  115. =====
  116. `generation`::
  117. (integer)
  118. Current <<data-streams-generation,generation>> for the data stream. This number
  119. acts as a cumulative count of the stream's rollovers, starting at `1`.
  120. `status`::
  121. (string)
  122. <<cluster-health,Health status>> of the data stream.
  123. +
  124. This health status is based on the state of the primary and replica shards of
  125. the stream's backing indices.
  126. +
  127. .Values for `status`
  128. [%collapsible%open]
  129. =====
  130. `green`:::
  131. All shards are assigned.
  132. `yellow`:::
  133. All primary shards are assigned, but one or more replica shards are
  134. unassigned.
  135. `red`:::
  136. One or more primary shards are unassigned, so some data is unavailable.
  137. =====
  138. `template`::
  139. (string)
  140. Name of the index template used to create the data stream's backing indices.
  141. +
  142. The template's index pattern must match the name of this data stream. See
  143. <<create-a-data-stream-template>>.
  144. `ilm_policy`::
  145. (string)
  146. Name of the current {ilm-init} lifecycle policy in the stream's matching index
  147. template. This lifecycle policy is set in the `index.lifecycle.name` setting.
  148. +
  149. If the template does not include a lifecycle policy, this property is not
  150. included in the response.
  151. +
  152. NOTE: A data stream's backing indices may be assigned different lifecycle
  153. policies. To retrieve the lifecycle policy for individual backing indices,
  154. use the <<indices-get-settings,get index settings API>>.
  155. ====
  156. [[get-data-stream-api-example]]
  157. ==== {api-examples-title}
  158. [source,console]
  159. ----
  160. GET _data_stream/my-data-stream*
  161. ----
  162. The API returns the following response:
  163. [source,console-result]
  164. ----
  165. {
  166. "data_streams": [
  167. {
  168. "name": "my-data-stream",
  169. "timestamp_field": {
  170. "name": "@timestamp"
  171. },
  172. "indices": [
  173. {
  174. "index_name": ".ds-my-data-stream-000001",
  175. "index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"
  176. },
  177. {
  178. "index_name": ".ds-my-data-stream-000002",
  179. "index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"
  180. }
  181. ],
  182. "generation": 2,
  183. "status": "GREEN",
  184. "template": "my-index-template",
  185. "ilm_policy": "my-lifecycle-policy"
  186. },
  187. {
  188. "name": "my-data-stream_two",
  189. "timestamp_field": {
  190. "name": "@timestamp"
  191. },
  192. "indices": [
  193. {
  194. "index_name": ".ds-my-data-stream_two-000001",
  195. "index_uuid": "3liBu2SYS5axasRt6fUIpA"
  196. }
  197. ],
  198. "generation": 1,
  199. "status": "YELLOW",
  200. "template": "my-index-template",
  201. "ilm_policy": "my-lifecycle-policy"
  202. }
  203. ]
  204. }
  205. ----
  206. // TESTRESPONSE[s/"index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"/"index_uuid": $body.data_streams.0.indices.0.index_uuid/]
  207. // TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
  208. // TESTRESPONSE[s/"index_uuid": "3liBu2SYS5axasRt6fUIpA"/"index_uuid": $body.data_streams.1.indices.0.index_uuid/]
  209. // TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW"/]