﻿---
title: Update the lifecycle of a data stream
description: Update the lifecycle of an Elasticsearch data stream. Change its data phases or remove the lifecycle.
url: https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/lifecycle/data-stream/tutorial-update-existing-data-stream
products:
  - Elastic Documentation
  - Elasticsearch
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# Update the lifecycle of a data stream
Change the lifecycle configuration for a classic Elasticsearch data stream, such as its data retention or phases.
For [wired](/elastic/docs-builder/docs/4643/solutions/observability/streams/get-data-in#get-data-in-wired) data streams, go to [Configure data lifecycle with Streams](https://www.elastic.co/elastic/docs-builder/docs/4643/solutions/observability/streams/configure-retention).
For index lifecycle management (ILM), refer to [Update or switch an Elasticsearch index lifecycle policy](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/lifecycle/index-lifecycle-management/policy-updates).

## Before you begin

To follow these steps, you need:
- A classic data stream. To create one, refer to [Creating a data stream with a lifecycle](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/lifecycle/data-stream/tutorial-create-data-stream-with-lifecycle).
- The `manage_data_stream_lifecycle` [index privilege](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4643/reference/elasticsearch/security-privileges#privileges-list-indices) on the data stream and its backing indices.
- To view and configure a failure store, the [required failure store permissions](/elastic/docs-builder/docs/4643/manage-data/data-store/data-streams/failure-store#required-permissions).
- <applies-to>Elastic Stack: Generally available since 9.5</applies-to> <applies-to>Elastic Cloud Serverless: Unavailable</applies-to> A default snapshot repository and an [appropriate license](https://www.elastic.co/subscriptions) for searchable snapshots if you turn on frozen phase transitions. Refer to [Manage snapshot repositories](https://www.elastic.co/elastic/docs-builder/docs/4643/deploy-manage/tools/snapshot-and-restore/manage-snapshot-repositories).


## Set a data stream's lifecycle

Add or change the data stream lifecycle with the **Index Management** or **Streams** tools in Kibana or the Elasticsearch [lifecycle API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-lifecycle).
<applies-switch>
  <applies-item title="serverless: ga" applies-to="Elastic Cloud Serverless: Generally available">
    1. Find **Index Management** in the navigation menu or use the [global search field](https://www.elastic.co/elastic/docs-builder/docs/4643/explore-analyze/find-and-organize/find-apps-and-objects).
    2. Select the **Data Streams** tab.
    3. Search for the data stream.
    4. Select the data stream to view its details.
    5. In the data stream details pane, click the actions icon `gear` and select **Edit data lifecycle**.
    6. To customize the lifecycle for this data stream, clear **Inherit lifecycle from index template** on each tab you want to edit:
       ![Edit data lifecycle flyout in Serverless.](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/images/elasticsearch-serverless-edit-data-lifecycle.png)
       - On the **Successful data** tab, select the **Delete phase** to choose how long to retain your data, in days, hours, minutes, or seconds.
    - On the **Failed data** tab, select **Enable failure store** to turn on a [failure store](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/data-store/data-streams/failure-store). Select how long to retain failure store data, in days, hours, minutes, or seconds.
    7. Click **Apply** to save the changes.
    Lifecycle changes apply to every backing index of the data stream.
  </applies-item>

  <applies-item title="stack: ga 9.5+" applies-to="Elastic Stack: Generally available since 9.5">
    1. Find **Index Management** in the navigation menu or use the [global search field](https://www.elastic.co/elastic/docs-builder/docs/4643/explore-analyze/find-and-organize/find-apps-and-objects).
    2. Select the **Data Streams** tab.
    3. Search for the data stream.
    4. Select the data stream to view its details.
    5. In the data stream details pane, click the actions icon `gear` and select **Edit data lifecycle**.
    6. To customize the lifecycle for this data stream, clear **Inherit lifecycle from index template** on each tab you want to edit:
       ![Edit data lifecycle flyout in Elastic Stack 9.5 and later.](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/images/elasticsearch-edit-data-lifecycle.png)
       - On the **Successful data** tab:
      Select the **Delete phase** to choose how long to retain your data, in days, hours, minutes, or seconds. If you deselect the delete phase, Elasticsearch does not delete the data.
      Select the **Frozen phase** to choose when to move your data to searchable snapshots, in days, hours, minutes, or seconds. This period must be shorter than the delete phase. To change the default snapshot repository, refer to [Elastic Cloud Hosted](/elastic/docs-builder/docs/4643/deploy-manage/tools/snapshot-and-restore/elastic-cloud-hosted#snapshot-repo-default) or [self-managed](/elastic/docs-builder/docs/4643/deploy-manage/tools/snapshot-and-restore/self-managed#snapshot-repo-default) instructions.
    - On the **Failed data** tab, select **Enable failure store** to turn on a [failure store](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/data-store/data-streams/failure-store). Select how long to retain failure store data, in days, hours, minutes, or seconds.
    7. Click **Apply** to save the changes.
    8. Reopen the data stream flyout to confirm the change. The flyout shows the successful and failure ingest lifecycle details.
    Lifecycle changes apply to every backing index of the data stream.
  </applies-item>

  <applies-item title="stack: ga 9.0-9.4" applies-to="Elastic Stack: Generally available from 9.0 to 9.4">
    1. Find **Index Management** in the navigation menu or use the [global search field](https://www.elastic.co/elastic/docs-builder/docs/4643/explore-analyze/find-and-organize/find-apps-and-objects).
    2. Select the **Data Streams** tab.
    3. Search for the data stream.
    4. Select the data stream to view its details.
    5. In the data stream details pane, select **Manage** → **Edit data retention**.
       ![Edit data retention flyout in Elastic Stack 9.0–9.4.](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/images/elasticsearch-edit-data-retention.png)
       You can do any of the following:
       - Select how long to retain your data, in days, hours, minutes, or seconds.
    - Select **Keep data indefinitely**. The data stream stays managed but Elasticsearch does not delete the data. Managing a time series data stream, such as logs or metrics, helps Elasticsearch store your data even when you don't set a retention period.
    - Turn off **Enable data retention** to stop data stream lifecycle management for this data stream.
    6. Click **Save** to save the changes.
    7. Reopen the data stream flyout to confirm the change. The flyout shows the effective data retention settings.
    Lifecycle changes apply to every backing index of the data stream.
  </applies-item>
</applies-switch>


<applies-to>Elastic Cloud Serverless: Generally available</applies-to> <applies-to>Elastic Stack: Generally available since 9.2, Elastic Stack: Preview in 9.1</applies-to> Alternatively, you can use the **Streams** page in Kibana, which is a centralized interface for common data management tasks, including how your data streams retain data. Refer to [Configure data lifecycle with Streams](https://www.elastic.co/elastic/docs-builder/docs/4643/solutions/observability/streams/configure-retention).
<dropdown title="API example">
  To update the lifecycle of a data stream, use the Elasticsearch [lifecycle API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-lifecycle).
  For example:
  - Set a retention period:
    ```json

    {
      "data_retention": "30d" <1>
    }
    ```
  - <applies-to>Elastic Stack: Generally available since 9.5</applies-to> <applies-to>Elastic Cloud Serverless: Unavailable</applies-to> Optionally add `frozen_after` so older backing indices become partially mounted searchable snapshots on the frozen tier:
    ```json

    {
      "data_retention": "365d",
      "frozen_after": "30d" <1>
    }
    ```
    In this example, backing indices older than 30 days are converted to frozen searchable snapshots.
    Elasticsearch can still delete indices when their `generation_time` exceeds the effective retention period, even after they are frozen.
    For prerequisites, how conversion works, and troubleshooting, refer to [Searchable snapshots for data streams](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/lifecycle/data-stream/dlm-searchable-snapshots).
  - Remove the lifecycle settings configured on the data stream:
    ```json

    { } <1>
    ```
  These lifecycle changes apply to every backing index of the data stream.
  To check the settings, use the Elasticsearch [explain API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-explain-data-lifecycle):
  ```json
  ```
  **Example response for the 30-day retention configuration:**
  ```json
  {
    "indices": {
      ".ds-my-data-stream-test-2026.10.17-000001": {
        "index": ".ds-my-data-stream-test-2026.10.17-000001", 
        "managed_by_lifecycle": true, 
        "index_creation_date_millis": 1792195511314,
        "time_since_index_creation": "2.97d", 
        "rollover_date_millis": 1792440980120,
        "time_since_rollover": "3.12h", 
        "generation_time": "3.12h", 
        "lifecycle": {
          "enabled": true,
          "data_retention": "30d", 
          "retention_determined_by": "data_stream_configuration"
        }
      },
      ".ds-my-data-stream-test-2026.10.19-000002": {
        "index": ".ds-my-data-stream-test-2026.10.19-000002",
        "managed_by_lifecycle": true,
        "index_creation_date_millis": 1792440980129,
        "time_since_index_creation": "3.12h",
        "lifecycle": {
          "enabled": true,
          "data_retention": "30d",
          "retention_determined_by": "data_stream_configuration"
        }
      }
    }
  }
  ```
</dropdown>


## Remove the lifecycle for a data stream

<applies-to>
  - Elastic Cloud Serverless: Unavailable
  - Elastic Stack: Generally available
</applies-to>

Remove the lifecycle with the Elasticsearch [delete lifecycle API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-delete-data-lifecycle).
For example:
```json
```

After this request, the maintenance operations from the lifecycle no longer apply to the data stream or its backing indices.
Use the [explain API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-explain-data-lifecycle) to verify that the indices are no longer managed.
```json
```

```json
{
  "indices": {
    ".ds-my-data-stream-test-2026.10.17-000001": {
      "index": ".ds-my-data-stream-test-2026.10.17-000001", 
      "managed_by_lifecycle": false, 
      "unmanaged_reason": "Index [.ds-my-data-stream-test-2026.10.17-000001] belongs to data stream [my-data-stream-test] which does not have data stream lifecycle configuration." 
    },
    ".ds-my-data-stream-test-2026.10.19-000002": {
      "index": ".ds-my-data-stream-test-2026.10.19-000002",
      "managed_by_lifecycle": false,
      "unmanaged_reason": "Index [.ds-my-data-stream-test-2026.10.19-000002] belongs to data stream [my-data-stream-test] which does not have data stream lifecycle configuration."
    }
  }
}
```


## Related pages

- [Data stream lifecycle in Elasticsearch](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/lifecycle/data-stream)
- [Data streams in Elasticsearch](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/data-store/data-streams)
- [Index lifecycle management (ILM) in Elasticsearch](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/lifecycle/index-lifecycle-management)
- [Granting privileges for data streams and aliases](https://www.elastic.co/elastic/docs-builder/docs/4643/deploy-manage/users-roles/cluster-or-deployment-auth/granting-privileges-for-data-streams-aliases)
- [Manage a data stream in Kibana](https://www.elastic.co/elastic/docs-builder/docs/4643/manage-data/data-store/data-streams/manage-data-stream)