---
type: api
title: Get data stream lifecycles
description: Get the data stream lifecycle configuration of one or more data streams.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-indices-get-data-lifecycle
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-indices-get-data-lifecycle
products:
  - Elasticsearch
---

# Get data stream lifecycles

Availability: 8.11+

## Paths

- `GET` `/_data_stream/{name}/_lifecycle`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#bearerauth)

#### Path Parameters

- `name` (union DataStreamName | [] DataStreamName)
  Comma-separated list of data streams to limit the request.
Supports wildcards (`*`).
To target all data streams, omit this parameter or use `*` or `_all`.

## Description

Get the data stream lifecycle configuration of one or more data streams.

[About data stream lifecycle](https://www.elastic.co/docs/manage-data/lifecycle/data-stream)

## Query String Parameters

- `expand_wildcards` (string ExpandWildcards · default: open)
  Type of data stream that wildcard patterns can match.
Supports comma-separated values, such as `open,hidden`.

Supported values include:
  - `all`: Match any data stream or index, including hidden ones.
  - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.
  - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
  - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.
  - `none`: Wildcard expressions are not accepted.
  Values: `all`, `open`, `closed`, `hidden`, `none`
- `include_defaults` (boolean · default: false)
  If `true`, return all default settings in the response.
- `master_timeout` (string Duration · default: 30s)
  Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

## Response

`application/json`

- `data_streams` ([] DataStreamWithLifecycle)
  - `name` (string)
  - `lifecycle` ({} DataStreamLifecycleWithRollover)
    - `data_retention` (string Duration)
      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 empty, every document in this data stream will be stored indefinitely.
    - `effective_retention` (string Duration)
      The least amount of time data should be kept by elasticsearch.
    - `retention_determined_by` (enum RetentionSource)
      Configuration source that can influence the retention of a data stream.
      Values: `data_stream_configuration`, `default_global_retention`, `max_global_retention`, `default_failures_retention`
    - `downsampling` ([] DownsamplingRound)
      The list of downsampling rounds to execute as part of this downsampling configuration
      - `after` (string Duration)
        The duration since rollover when this downsampling round should execute
      - `fixed_interval` (string)
        The downsample interval.
    - `downsampling_method` (enum SamplingMethod)
      The method used to downsample the data. There are two options `aggregate` and `last_value`. It requires
`downsampling` to be defined. Defaults to `aggregate`.
      Values: `aggregate`, `last_value`
    - `enabled` (boolean · default: true)
      If defined, it turns data stream lifecycle on/off (`true`/`false`) for this data stream. A data stream lifecycle
that's disabled (enabled: `false`) will have no effect on the data stream.
    - `frozen_after` (string Duration)
      The period after which data stream backing indices are automatically converted to partially mounted searchable snapshots.
This field is valid only on main data stream lifecycles and cannot be set on failure-store lifecycles.
    - `rollover` ({} DataStreamLifecycleRolloverConditions)
      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.
      - `min_age` (string Duration)
      - `max_age` (string)
      - `min_docs` (number)
      - `max_docs` (number)
      - `min_size` (number | string ByteSize)
      - `max_size` (number | string ByteSize)
      - `min_primary_shard_size` (number | string ByteSize)
      - `max_primary_shard_size` (number | string ByteSize)
      - `min_primary_shard_docs` (number)
      - `max_primary_shard_docs` (number)
- `global_retention` ({} GlobalRetention)
  - `max_retention` (string Duration)
  - `default_retention` (string Duration)
## Code Examples

#### Console

```console
GET /_data_stream/{name}/_lifecycle?human&pretty
```

#### JavaScript

```javascript
const response = await client.indices.getDataLifecycle({
  name: "{name}",
  human: "true",
  pretty: "true",
});
```

#### Python

```python
resp = client.indices.get_data_lifecycle(
    name="{name}",
    human=True,
    pretty=True,
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_data_stream/%7Bname%7D/_lifecycle?human&pretty" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.indices().getDataLifecycle(g -> g
    .name("{name}")
);
```

#### C#

```c#
var response = await client.Indices.GetDataLifecycleAsync(name: new[] { "{name}" });
```

#### PHP

```php
$resp = $client->indices()->getDataLifecycle([
    "name" => "{name}",
    "human" => "true",
    "pretty" => "true",
]);
```

#### Ruby

```ruby
response = client.indices.get_data_lifecycle(
  name: "{name}",
  human: "true",
  pretty: "true"
)
```

## Response Examples

#### Indices get data lifecycle response example1

A successful response from `GET /_data_stream/{name}/_lifecycle?human&pretty`.

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

