---
type: api
title: Get data stream lifecycle stats
description: Get statistics about the data streams that are managed by a data stream lifecycle.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-indices-get-data-lifecycle-stats
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-indices-get-data-lifecycle-stats
products:
  - Elasticsearch
---

# Get data stream lifecycle stats

Availability: 8.12+

## Paths

- `GET` `/_lifecycle/stats`

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

## Description

Get statistics about the data streams that are managed by a data stream lifecycle.

## Required authorization

* Cluster privileges: `monitor`

[Read the reference documentation](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/data-stream-lifecycle.html)

## Response

`application/json`

- `data_stream_count` (number)
  The count of data streams currently being managed by the data stream lifecycle.
- `data_streams` ([] DataStreamStats)
  Information about the data streams that are managed by the data stream lifecycle.
  - `backing_indices_in_error` (number)
    The count of the backing indices for the data stream.
  - `backing_indices_in_total` (number)
    The count of the backing indices for the data stream that have encountered an error.
  - `name` (string)
    The name of the data stream.
- `last_run_duration_in_millis` (DurationValueUnitMillis)
  The duration of the last data stream lifecycle execution.
- `time_between_starts_in_millis` (DurationValueUnitMillis)
  The time that passed between the start of the last two data stream lifecycle executions.
This value should amount approximately to `data_streams.lifecycle.poll_interval`.
## Code Examples

#### Console

```console
GET _lifecycle/stats?human&pretty
```

#### JavaScript

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

#### Python

```python
resp = client.indices.get_data_lifecycle_stats(
    human=True,
    pretty=True,
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_lifecycle/stats?human&pretty" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.indices().getDataLifecycleStats();
```

#### C#

```c#
var response = await client.Indices.GetDataLifecycleStatsAsync();
```

#### PHP

```php
$resp = $client->indices()->getDataLifecycleStats([
    "human" => "true",
    "pretty" => "true",
]);
```

#### Ruby

```ruby
response = client.indices.get_data_lifecycle_stats(
  human: "true",
  pretty: "true"
)
```

## Response Examples

#### Indices get data lifecycle stats response example1

A successful response for `GET _lifecycle/stats?human&pretty`

```json
{
  "last_run_duration_in_millis": 2,
  "last_run_duration": "2ms",
  "time_between_starts_in_millis": 9998,
  "time_between_starts": "9.99s",
  "data_streams_count": 2,
  "data_streams": [
    {
      "name": "my-data-stream",
      "backing_indices_in_total": 2,
      "backing_indices_in_error": 0
    },
    {
      "name": "my-other-stream",
      "backing_indices_in_total": 2,
      "backing_indices_in_error": 1
    }
  ]
}
```

