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

# Get data streams


Availability: 7.9+

## Paths

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

- [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)

#### Path Parameters

- `name` (union DataStreamName | [] DataStreamName) — optional, leave it out to use `/_data_stream`
  Comma-separated list of data stream names used to limit the request.
Wildcard (`*`) expressions are supported. If omitted, all data streams are returned.

## Description

Get information about one or more data streams.

## Required authorization

* Index privileges: `view_index_metadata`

## 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, returns all relevant default configurations for the index template.
- `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.
- `verbose` (boolean · default: false)
  Whether the maximum timestamp for each data stream should be calculated and returned.

## Response

`application/json`

- `data_streams` ([] DataStream)
  - `_meta` (Metadata)
    Custom metadata for the stream, copied from the `_meta` object of the stream’s matching index template.
If empty, the response omits this property.
  - `allow_custom_routing` (boolean)
    If `true`, the data stream allows custom routing on write request.
  - `failure_store` ({} FailureStore)
    Information about failure store backing indices
    - `enabled` (boolean)
    - `indices` ([] DataStreamIndex)
      - `index_name` (string IndexName)
        Name of the backing index.
      - `index_uuid` (string)
        Universally unique identifier (UUID) for the index.
      - `ilm_policy` (string Name)
        Name of the current ILM lifecycle policy configured for this backing index.
      - `managed_by` (enum ManagedBy)
        Name of the lifecycle system that's currently managing this backing index.
        Values: `Index Lifecycle Management`, `Data stream lifecycle`, `Unmanaged`
      - `prefer_ilm` (boolean)
        Indicates if ILM should take precedence over DSL in case both are configured to manage this index.
    - `rollover_on_write` (boolean)
  - `generation` (number)
    Current generation for the data stream. This number acts as a cumulative count of the stream’s rollovers, starting at 1.
  - `hidden` (boolean)
    If `true`, the data stream is hidden.
  - `ilm_policy` (string Name)
    Name of the current ILM lifecycle policy in the stream’s matching index template.
This lifecycle policy is set in the `index.lifecycle.name` setting.
If the template does not include a lifecycle policy, this property is not included in the response.
NOTE: A data stream’s backing indices may be assigned different lifecycle policies. To retrieve the lifecycle policy for individual backing indices, use the get index settings API.
  - `next_generation_managed_by` (enum ManagedBy)
    Name of the lifecycle system that'll manage the next generation of the data stream.
    Values: `Index Lifecycle Management`, `Data stream lifecycle`, `Unmanaged`
  - `prefer_ilm` (boolean)
    Indicates if ILM should take precedence over DSL in case both are configured to managed this data stream.
  - `indices` ([] DataStreamIndex)
    Array of objects containing information about the data stream’s backing indices.
The last item in this array contains information about the stream’s current write index.
    - `index_name` (string IndexName)
      Name of the backing index.
    - `index_uuid` (string)
      Universally unique identifier (UUID) for the index.
    - `ilm_policy` (string Name)
      Name of the current ILM lifecycle policy configured for this backing index.
    - `managed_by` (enum ManagedBy)
      Name of the lifecycle system that's currently managing this backing index.
      Values: `Index Lifecycle Management`, `Data stream lifecycle`, `Unmanaged`
    - `prefer_ilm` (boolean)
      Indicates if ILM should take precedence over DSL in case both are configured to manage this index.
  - `lifecycle` ({} DataStreamLifecycleWithRollover)
    Contains the configuration for the data stream lifecycle of this data stream.
    - `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
      - `config` ({} DownsampleConfig)
        The downsample configuration to execute.
        - `fixed_interval` (string)
          The interval at which to aggregate the original time series index.
    - `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.
    - `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)
  - `name` (string)
    Name of the data stream.
  - `replicated` (boolean)
    If `true`, the data stream is created and managed by cross-cluster replication and the local cluster can not write into this data stream or change its mappings.
  - `rollover_on_write` (boolean)
    If `true`, the next write to this data stream will trigger a rollover first and the document will be indexed in the new backing index. If the rollover fails the indexing request will fail too.
  - `settings` (IndexSettings)
    The settings specific to this data stream that will take precedence over the settings in the matching index
template.
  - `status` (enum HealthStatus)
    Health status of the data stream.
This health status is based on the state of the primary and replica shards of the stream’s backing indices.

Supported values include:
  - `green` (or `GREEN`): All shards are assigned.
  - `yellow` (or `YELLOW`): All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
  - `red` (or `RED`): One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
  - `unknown`
  - `unavailable`
    Values: `green`, `GREEN`, `yellow`, `YELLOW`, `red`, `RED`, `unknown`, `unavailable`
  - `system` (boolean)
    If `true`, the data stream is created and managed by an Elastic stack component and cannot be modified through normal user interaction.
  - `template` (string Name)
    Name of the index template used to create the data stream’s backing indices.
The template’s index pattern must match the name of this data stream.
  - `timestamp_field` ({} DataStreamTimestampField)
    Information about the `@timestamp` field in the data stream.
    - `name` (string Field)
      Name of the timestamp field for the data stream, which must be `@timestamp`. The `@timestamp` field must be included in every document indexed to the data stream.
## Code Examples

#### Console

```console
GET _data_stream/my-data-stream
```

#### JavaScript

```javascript
const response = await client.indices.getDataStream({
  name: "my-data-stream",
});
```

#### Python

```python
resp = client.indices.get_data_stream(
    name="my-data-stream",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_data_stream/my-data-stream" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.indices().getDataStream(g -> g
    .name("my-data-stream")
);
```

#### C#

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

#### PHP

```php
$resp = $client->indices()->getDataStream([
    "name" => "my-data-stream",
]);
```

#### Ruby

```ruby
response = client.indices.get_data_stream(
  name: "my-data-stream"
)
```

## Response Examples

#### Indices get data stream response example1

A successful response for retrieving information about a data stream.

```json
{
  "data_streams": [
    {
      "name": "my-data-stream",
      "timestamp_field": {
        "name": "@timestamp"
      },
      "indices": [
        {
          "index_name": ".ds-my-data-stream-2099.03.07-000001",
          "index_uuid": "xCEhwsp8Tey0-FLNFYVwSg",
          "prefer_ilm": true,
          "ilm_policy": "my-lifecycle-policy",
          "managed_by": "Index Lifecycle Management"
        },
        {
          "index_name": ".ds-my-data-stream-2099.03.08-000002",
          "index_uuid": "PA_JquKGSiKcAKBA8DJ5gw",
          "prefer_ilm": true,
          "ilm_policy": "my-lifecycle-policy",
          "managed_by": "Index Lifecycle Management"
        }
      ],
      "generation": 2,
      "_meta": {
        "my-meta-field": "foo"
      },
      "status": "GREEN",
      "next_generation_managed_by": "Index Lifecycle Management",
      "prefer_ilm": true,
      "template": "my-index-template",
      "ilm_policy": "my-lifecycle-policy",
      "hidden": false,
      "system": false,
      "allow_custom_routing": false,
      "replicated": false,
      "rollover_on_write": false
    },
    {
      "name": "my-data-stream-two",
      "timestamp_field": {
        "name": "@timestamp"
      },
      "indices": [
        {
          "index_name": ".ds-my-data-stream-two-2099.03.08-000001",
          "index_uuid": "3liBu2SYS5axasRt6fUIpA",
          "prefer_ilm": true,
          "ilm_policy": "my-lifecycle-policy",
          "managed_by": "Index Lifecycle Management"
        }
      ],
      "generation": 1,
      "_meta": {
        "my-meta-field": "foo"
      },
      "status": "YELLOW",
      "next_generation_managed_by": "Index Lifecycle Management",
      "prefer_ilm": true,
      "template": "my-index-template",
      "ilm_policy": "my-lifecycle-policy",
      "hidden": false,
      "system": false,
      "allow_custom_routing": false,
      "replicated": false,
      "rollover_on_write": false
    }
  ]
}
```

