get-data-stream.asciidoc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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 backing indices, including
  120. deleted indices.
  121. `status`::
  122. (string)
  123. <<cluster-health,Health status>> of the data stream.
  124. +
  125. This health status is based on the state of the primary and replica shards of
  126. the stream's backing indices.
  127. +
  128. .Values for `status`
  129. [%collapsible%open]
  130. =====
  131. `green`:::
  132. All shards are assigned.
  133. `yellow`:::
  134. All primary shards are assigned, but one or more replica shards are
  135. unassigned.
  136. `red`:::
  137. One or more primary shards are unassigned, so some data is unavailable.
  138. =====
  139. `template`::
  140. (string)
  141. Name of the index template used to create the data stream's backing indices.
  142. +
  143. The template's index pattern must match the name of this data stream. See
  144. <<create-a-data-stream-template>>.
  145. `ilm_policy`::
  146. (string)
  147. Name of the current {ilm-init} lifecycle policy in the stream's matching index
  148. template. This lifecycle policy is set in the `index.lifecycle.name` setting.
  149. +
  150. If the template does not include a lifecycle policy, this property is not
  151. included in the response.
  152. +
  153. NOTE: A data stream's backing indices may be assigned different lifecycle
  154. policies. To retrieve the lifecycle policy for individual backing indices,
  155. use the <<indices-get-settings,get index settings API>>.
  156. ====
  157. [[get-data-stream-api-example]]
  158. ==== {api-examples-title}
  159. [source,console]
  160. ----
  161. GET _data_stream/my-data-stream*
  162. ----
  163. The API returns the following response:
  164. [source,console-result]
  165. ----
  166. {
  167. "data_streams": [
  168. {
  169. "name": "my-data-stream",
  170. "timestamp_field": {
  171. "name": "@timestamp"
  172. },
  173. "indices": [
  174. {
  175. "index_name": ".ds-my-data-stream-000001",
  176. "index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"
  177. },
  178. {
  179. "index_name": ".ds-my-data-stream-000002",
  180. "index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"
  181. }
  182. ],
  183. "generation": 2,
  184. "status": "GREEN",
  185. "template": "my-index-template",
  186. "ilm_policy": "my-lifecycle-policy"
  187. },
  188. {
  189. "name": "my-data-stream_two",
  190. "timestamp_field": {
  191. "name": "@timestamp"
  192. },
  193. "indices": [
  194. {
  195. "index_name": ".ds-my-data-stream_two-000001",
  196. "index_uuid": "3liBu2SYS5axasRt6fUIpA"
  197. }
  198. ],
  199. "generation": 1,
  200. "status": "YELLOW",
  201. "template": "my-index-template",
  202. "ilm_policy": "my-lifecycle-policy"
  203. }
  204. ]
  205. }
  206. ----
  207. // TESTRESPONSE[s/"index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"/"index_uuid": $body.data_streams.0.indices.0.index_uuid/]
  208. // TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
  209. // TESTRESPONSE[s/"index_uuid": "3liBu2SYS5axasRt6fUIpA"/"index_uuid": $body.data_streams.1.indices.0.index_uuid/]
  210. // TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW"/]