get-lifecycle.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. [[dlm-get-lifecycle]]
  2. === Get the lifecycle of a data stream
  3. ++++
  4. <titleabbrev>Get Data Stream Lifecycle</titleabbrev>
  5. ++++
  6. experimental::[]
  7. Gets the lifecycle of a set of data streams.
  8. [[dlm-get-lifecycle-request]]
  9. ==== {api-request-title}
  10. `GET _data_stream/<data-stream>/_lifecycle`
  11. [[dlm-get-lifecycle-desc]]
  12. ==== {api-description-title}
  13. Gets the lifecycle of the specified data streams. If multiple data streams are requested but at least one of them
  14. does not exist, then the API will respond with `404` since at least one of the requested resources could not be retrieved.
  15. [[dlm-get-lifecycle-path-params]]
  16. ==== {api-path-parms-title}
  17. `<data-stream>`::
  18. (Required, string) Comma-separated list of data streams used to limit the request. Supports wildcards (`*`).
  19. To target all data streams use `*` or `_all`.
  20. [role="child_attributes"]
  21. [[get-data-lifecycle-api-query-parms]]
  22. ==== {api-query-parms-title}
  23. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=ds-expand-wildcards]
  24. +
  25. Defaults to `open`.
  26. `include_defaults`::
  27. (Optional, Boolean) If `true`, return all default settings in the response.
  28. Defaults to `false`.
  29. [role="child_attributes"]
  30. [[get-lifecycle-api-response-body]]
  31. ==== {api-response-body-title}
  32. `data_streams`::
  33. (array of objects)
  34. Contains information about retrieved data stream lifecycles.
  35. +
  36. .Properties of objects in `data_streams`
  37. [%collapsible%open]
  38. ====
  39. `name`::
  40. (string)
  41. Name of the data stream.
  42. `lifecycle`::
  43. (object)
  44. +
  45. .Properties of `lifecycle`
  46. [%collapsible%open]
  47. =====
  48. `data_retention`::
  49. (string)
  50. If defined, every document added to this data stream will be stored at least for this time frame. Any time after this
  51. duration the document could be deleted. When undefined, every document in this data stream will be stored indefinitely.
  52. `rollover`::
  53. (object)
  54. The conditions which will trigger the rollover of a backing index as configured by the cluster setting
  55. `cluster.dlm.default.rollover`. This property is an implementation detail and it will only be retrieved when the query
  56. param `include_defaults` is set to `true`. The contents of this field are subject to change.
  57. =====
  58. ====
  59. [[dlm-get-lifecycle-example]]
  60. ==== {api-examples-title}
  61. ////
  62. [source,console]
  63. --------------------------------------------------
  64. PUT /_index_template/my-template
  65. {
  66. "index_patterns" : ["my-data-stream*"],
  67. "priority" : 1,
  68. "data_stream": {},
  69. "template": {
  70. "lifecycle" : {
  71. "data_retention" : "7d"
  72. }
  73. }
  74. }
  75. PUT /_data_stream/my-data-stream-1
  76. PUT /_data_stream/my-data-stream-2
  77. --------------------------------------------------
  78. // TESTSETUP
  79. [source,console]
  80. --------------------------------------------------
  81. DELETE _data_stream/my-data-stream*
  82. DELETE _index_template/my-template
  83. --------------------------------------------------
  84. // TEARDOWN
  85. ////
  86. Let's retrieve the lifecycles:
  87. [source,console]
  88. --------------------------------------------------
  89. GET _data_stream/my-data-stream*/_lifecycle
  90. --------------------------------------------------
  91. The response will look like the following:
  92. [source,console-result]
  93. --------------------------------------------------
  94. {
  95. "data_streams": [
  96. {
  97. "name": "my-data-stream-1",
  98. "lifecycle": {
  99. "data_retention": "7d"
  100. }
  101. },
  102. {
  103. "name": "my-data-stream-2",
  104. "lifecycle": {
  105. "data_retention": "7d"
  106. }
  107. }
  108. ]
  109. }
  110. --------------------------------------------------