Get the lifecycle of a data streamedit

This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

Gets the lifecycle of a set of data streams.


  • If the Elasticsearch security features are enabled, you must have at least one of the manage index privilege, the manage_data_stream_lifecycle index privilege, or the view_index_metadata privilege to use this API. For more information, see Security privileges.


GET _data_stream/<data-stream>/_lifecycle


Gets the lifecycle of the specified data streams. If multiple data streams are requested but at least one of them does not exist, then the API will respond with 404 since at least one of the requested resources could not be retrieved. If the requested data streams do not have a lifecycle configured they will still be included in the API response but the lifecycle key will be missing.

Path parametersedit

(Required, string) Comma-separated list of data streams used to limit the request. Supports wildcards (*). To target all data streams use * or _all.

Query parametersedit


(Optional, string) Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden. Valid values are:

all, hidden
Match any data stream, including hidden ones.
open, closed
Matches any non-hidden data stream. Data streams cannot be closed.
Wildcard patterns are not accepted.

Defaults to open.

(Optional, Boolean) If true, return all default settings in the response. Defaults to false.

Response bodyedit


(array of objects) Contains information about retrieved data stream lifecycles.

Properties of objects in data_streams
(string) Name of the data stream.

(Optional, object)

Properties of lifecycle
(Optional, string) If defined, every document added to this data stream will be stored at least for this time frame. Any time after this duration the document could be deleted. When undefined, every document in this data stream will be stored indefinitely.
(Optional, object) The conditions which will trigger the rollover of a backing index as configured by the cluster setting cluster.lifecycle.default.rollover. This property is an implementation detail and it will only be retrieved when the query param include_defaults is set to true. The contents of this field are subject to change.


Let’s retrieve the lifecycles:

response = client.indices.get_data_lifecycle(
  name: 'my-data-stream*'
puts response
GET _data_stream/my-data-stream*/_lifecycle

The response will look like the following:

  "data_streams": [
      "name": "my-data-stream-1",
      "lifecycle": {
        "enabled": true,
        "data_retention": "7d"
      "name": "my-data-stream-2",
      "lifecycle": {
        "enabled": true,
        "data_retention": "7d"