get-data-stream.asciidoc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. [[indices-get-data-stream]]
  2. === Get data stream API
  3. ++++
  4. <titleabbrev>Get data stream</titleabbrev>
  5. ++++
  6. Retrieves information about one or more <<data-streams,data streams>>.
  7. See <<get-info-about-a-data-stream>>.
  8. ////
  9. [source,console]
  10. ----
  11. PUT /_ilm/policy/my-lifecycle-policy
  12. {
  13. "policy": {
  14. "phases": {
  15. "hot": {
  16. "actions": {
  17. "rollover": {
  18. "max_size": "25GB"
  19. }
  20. }
  21. },
  22. "delete": {
  23. "min_age": "30d",
  24. "actions": {
  25. "delete": {}
  26. }
  27. }
  28. }
  29. }
  30. }
  31. PUT /_index_template/my-index-template
  32. {
  33. "index_patterns": [ "my-data-stream*" ],
  34. "data_stream": {
  35. "timestamp_field": "@timestamp"
  36. },
  37. "template": {
  38. "mappings": {
  39. "properties": {
  40. "@timestamp": {
  41. "type": "date"
  42. }
  43. }
  44. },
  45. "settings": {
  46. "index.lifecycle.name": "my-lifecycle-policy"
  47. }
  48. }
  49. }
  50. PUT /_data_stream/my-data-stream
  51. POST /my-data-stream/_rollover
  52. PUT /_data_stream/my-data-stream_two
  53. ----
  54. // TESTSETUP
  55. ////
  56. ////
  57. [source,console]
  58. ----
  59. DELETE /_data_stream/*
  60. DELETE /_index_template/*
  61. DELETE /_ilm/policy/my-lifecycle-policy
  62. ----
  63. // TEARDOWN
  64. ////
  65. [source,console]
  66. ----
  67. GET /_data_stream/my-data-stream
  68. ----
  69. [[get-data-stream-api-request]]
  70. ==== {api-request-title}
  71. `GET /_data_stream/<data-stream>`
  72. [[get-data-stream-api-path-params]]
  73. ==== {api-path-parms-title}
  74. `<data-stream>`::
  75. (Required, string)
  76. Name of the data stream to retrieve.
  77. Wildcard (`*`) expressions are supported.
  78. [role="child_attributes"]
  79. [[get-data-stream-api-response-body]]
  80. ==== {api-response-body-title}
  81. `data_streams`::
  82. (array of objects)
  83. Contains information about retrieved data streams.
  84. +
  85. .Properties of objects in `data_streams`
  86. [%collapsible%open]
  87. ====
  88. `name`::
  89. (string)
  90. Name of the data stream.
  91. `timestamp_field`::
  92. (object)
  93. Contains information about the data stream's timestamp field.
  94. +
  95. .Properties of `timestamp_field`
  96. [%collapsible%open]
  97. =====
  98. `name`::
  99. (string)
  100. Name of the data stream's timestamp field. This field must be included in every
  101. document indexed to the data stream.
  102. `mapping`::
  103. (<<mapping,field mapping object>>)
  104. Field mapping for the data stream's timestamp field.
  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 backing indices, including
  129. deleted indices.
  130. `status`::
  131. (string)
  132. <<cluster-health,Health status>> of the data stream.
  133. +
  134. This health status is based on the state of the primary and replica shards of
  135. the stream's backing indices.
  136. +
  137. .Values for `status`
  138. [%collapsible%open]
  139. =====
  140. `green`:::
  141. All shards are assigned.
  142. `yellow`:::
  143. All primary shards are assigned, but one or more replica shards are
  144. unassigned.
  145. `red`:::
  146. One or more primary shards are unassigned, so some data is unavailable.
  147. =====
  148. `template`::
  149. (string)
  150. Name of the index template used to create the data stream's backing indices.
  151. +
  152. The template's index pattern must match the name of this data stream. See
  153. <<create-a-data-stream-template>>.
  154. `ilm_policy`::
  155. (string)
  156. Name of the current {ilm-init} lifecycle policy in the stream's matching index
  157. template. This lifecycle policy is set in the `index.lifecycle.name` setting.
  158. +
  159. If the template does not include a lifecycle policy, this property is not
  160. included in the response.
  161. +
  162. NOTE: A data stream's backing indices may be assigned different lifecycle
  163. policies. To retrieve the lifecycle policy for individual backing indices,
  164. use the <<indices-get-settings,get index settings API>>.
  165. ====
  166. [[get-data-stream-api-example]]
  167. ==== {api-examples-title}
  168. [source,console]
  169. ----
  170. GET _data_stream/my-data-stream*
  171. ----
  172. The API returns the following response:
  173. [source,console-result]
  174. ----
  175. {
  176. "data_streams": [
  177. {
  178. "name": "my-data-stream",
  179. "timestamp_field": {
  180. "name": "@timestamp",
  181. "mapping": {
  182. "type": "date"
  183. }
  184. },
  185. "indices": [
  186. {
  187. "index_name": ".ds-my-data-stream-000001",
  188. "index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"
  189. },
  190. {
  191. "index_name": ".ds-my-data-stream-000002",
  192. "index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"
  193. }
  194. ],
  195. "generation": 2,
  196. "status": "GREEN",
  197. "template": "my-index-template",
  198. "ilm_policy": "my-lifecycle-policy"
  199. },
  200. {
  201. "name": "my-data-stream_two",
  202. "timestamp_field": {
  203. "name": "@timestamp",
  204. "mapping": {
  205. "type": "date"
  206. }
  207. },
  208. "indices": [
  209. {
  210. "index_name": ".ds-my-data-stream_two-000001",
  211. "index_uuid": "3liBu2SYS5axasRt6fUIpA"
  212. }
  213. ],
  214. "generation": 1,
  215. "status": "YELLOW",
  216. "template": "my-index-template",
  217. "ilm_policy": "my-lifecycle-policy"
  218. }
  219. ]
  220. }
  221. ----
  222. // TESTRESPONSE[s/"index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"/"index_uuid": $body.data_streams.0.indices.0.index_uuid/]
  223. // TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
  224. // TESTRESPONSE[s/"index_uuid": "3liBu2SYS5axasRt6fUIpA"/"index_uuid": $body.data_streams.1.indices.0.index_uuid/]
  225. // TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW"/]