Update the lifecycle of a data stream

Change the lifecycle configuration for a classic Elasticsearch data stream, such as its data retention or phases. You can also turn off the lifecycle.

For wired data streams, go to Configure data lifecycle with Streams. For index lifecycle management (ILM), refer to Update or switch an Elasticsearch index lifecycle policy.

To follow these steps, you need:

Add or change the data stream lifecycle with the Index Management or Streams tools in Kibana or the Elasticsearch lifecycle API.

  1. Find Index Management in the navigation menu or use the global search field.

  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 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.
    • 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. 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.

  1. Find Index Management in the navigation menu or use the global search field.

  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 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.
    • 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 or self-managed instructions.

    • On the Failed data tab, select Enable failure store to turn on a 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.

  1. Find Index Management in the navigation menu or use the global search field.

  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.

    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.

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.

To temporarily stop data stream lifecycle from managing a data stream, use the Elasticsearch lifecycle API. For example, you might need to turn off the lifecycle when you reindex or load historical data in a time series data stream.

For example:

				PUT _data_stream/my-data-stream-test/_lifecycle
					{
  "enabled": false
}
		

This request turns off data stream lifecycle for every backing index of this stream, including indices that already exist. It doesn't change the index template, so new data streams that match the template can still be managed.

To turn off the lifecycle in the index template, use the Elasticsearch index template API. For example:

				PUT _index_template/my-data-stream-test-template
					{
  "index_patterns": ["my-data-stream-test*"],
  "data_stream": {},
  "template": {
    "lifecycle": {
      "enabled": false
    }
  }
}
		
Note

These APIs don't change the failure store lifecycle.

You can use the explain API to get lifecycle information for each backing index.

To permanently remove a lifecycle from a data stream, use the delete data stream lifecycles API.

Tip

If you remove the lifecycle from a time series data stream, it reverts to the minimum lifecycle.