---
type: api
title: Get data stream stats
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-indices-data-streams-stats
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-indices-data-streams-stats
products:
  - Elasticsearch
---

# Get data stream stats


Availability: 7.9+

## Paths

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

- [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 IndexName | [] IndexName) — optional, leave it out to use `/_data_stream/_stats`
  Comma-separated list of data streams used to limit the request.
Wildcard expressions (`*`) are supported.
To target all data streams in a cluster, omit this parameter or use `*`.

## Description

Get statistics for one or more data streams.

## Required authorization

* Index privileges: `monitor`

## Query String Parameters

- `expand_wildcards` (string ExpandWildcards · default: open,closed)
  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`

## Response

`application/json`

- `_shards` ({} ShardStatistics)
  Contains information about shards that attempted to execute the request.
  - `failed` (number uint)
    The number of shards the operation or search attempted to run on but failed.
  - `successful` (number uint)
    The number of shards the operation or search succeeded on.
  - `total` (number uint)
    The number of shards the operation or search will run on overall.
  - `failures` ([] ShardFailure)
    - `index` (string IndexName)
    - `node` (string)
    - `reason` ({} ErrorCause)
      - `type` (string)
        The type of error
      - `reason` (union string) — nullable
        A human-readable explanation of the error, in English.
        One of: `string`
      - `stack_trace` (string)
        The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
      - `caused_by` ({} ErrorCause) — recursive
        Same fields as `reason` in `failures`
      - `root_cause` ([] ErrorCause) — recursive
        Same fields as `reason` in `failures`
      - `suppressed` ([] ErrorCause) — recursive
        Same fields as `reason` in `failures`
    - `shard` (number)
    - `status` (string)
    - `primary` (boolean)
  - `skipped` (number uint)
- `backing_indices` (number)
  Total number of backing indices for the selected data streams.
- `data_stream_count` (number)
  Total number of selected data streams.
- `data_streams` ([] DataStreamsStatsItem)
  Contains statistics for the selected data streams.
  - `backing_indices` (number)
    Current number of backing indices for the data stream.
  - `data_stream` (string Name)
    Name of the data stream.
  - `maximum_timestamp` (EpochTimeUnitMillis)
    The data stream’s highest `@timestamp` value, converted to milliseconds since the Unix epoch.
NOTE: This timestamp is provided as a best effort.
The data stream may contain `@timestamp` values higher than this if one or more of the following conditions are met:
The stream contains closed backing indices;
Backing indices with a lower generation contain higher `@timestamp` values.
  - `store_size` (number | string ByteSize)
    Total size of all shards for the data stream’s backing indices.
This parameter is only returned if the `human` query parameter is `true`.
  - `store_size_bytes` (number)
    Total size, in bytes, of all shards for the data stream’s backing indices.
- `total_store_sizes` (number | string ByteSize)
  Total size of all shards for the selected data streams.
This property is included only if the `human` query parameter is `true`
- `total_store_size_bytes` (number)
  Total size, in bytes, of all shards for the selected data streams.
## Code Examples

#### Console

```console
GET /_data_stream/my-index-000001/_stats
```

#### JavaScript

```javascript
const response = await client.indices.dataStreamsStats({
  name: "my-index-000001",
});
```

#### Python

```python
resp = client.indices.data_streams_stats(
    name="my-index-000001",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_data_stream/my-index-000001/_stats" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.indices().dataStreamsStats(d -> d
    .name("my-index-000001")
);
```

#### C#

```c#
var response = await client.Indices
    .DataStreamsStatsAsync(d1 => d1
        .Name(new[] { "my-index-000001" })
    );
```

#### PHP

```php
$resp = $client->indices()->dataStreamsStats([
    "name" => "my-index-000001",
]);
```

#### Ruby

```ruby
response = client.indices.data_streams_stats(
  name: "my-index-000001"
)
```

## Response Examples

#### Indices data stream stats response example1

A successful response for retrieving statistics for a data stream.

```json
{
  "_shards": {
    "total": 10,
    "successful": 5,
    "failed": 0
  },
  "data_stream_count": 2,
  "backing_indices": 5,
  "total_store_size": "7kb",
  "total_store_size_bytes": 7268,
  "data_streams": [
    {
      "data_stream": "my-data-stream",
      "backing_indices": 3,
      "store_size": "3.7kb",
      "store_size_bytes": 3772,
      "maximum_timestamp": 1607512028000
    },
    {
      "data_stream": "my-data-stream-two",
      "backing_indices": 2,
      "store_size": "3.4kb",
      "store_size_bytes": 3496,
      "maximum_timestamp": 1607425567000
    }
  ]
}
```

