﻿---
title: Time-bound indices and dimension-based routing
description: Unlike regular data streams that write only to the most recent backing index, time series data streams (TSDS) are backed by a set of time-bound indices,...
url: https://www.elastic.co/elastic/docs-builder/docs/4300/manage-data/data-store/data-streams/time-bound-tsds
products:
  - Elastic Documentation
  - Elasticsearch
applies_to:
  - Serverless Elasticsearch projects: Generally available
  - Serverless Observability projects: Generally available
  - Serverless Security projects: Generally available
  - Serverless Elasticsearch Vector Database projects: Unavailable
  - Elastic Stack: Generally available
---

# Time-bound indices and dimension-based routing
Unlike regular data streams that write only to the most recent backing index, time series data streams (TSDS) are backed by a set of time-bound indices, each covering a contiguous, non-overlapping time range.
Elasticsearch enforces that the `@timestamp` for each ingested document falls within the time range of exactly one backing index.

## How time-bound indices work

Each TSDS backing index has a range of `@timestamp` values that it accepts, which are tracked in index settings.
When the TSDS is created, the first backing index has the following range:
- Its [`index.time_series.start_time`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-settings/time-series#index-time-series-start-time), which is the earliest accepted timestamp (inclusive), is set to `now` minus the [`index.look_back_time`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-settings/time-series#index-look-back-time).
- Its [`index.time_series.end_time`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-settings/time-series#index-time-series-end-time), which is the latest accepted timestamp (exclusive), is set to `now` plus [`index.look_ahead_time`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-settings/time-series#index-look-ahead-time).

Thereafter, Elasticsearch automatically configures the settings for backing indices as part of the index creation and [rollover](https://www.elastic.co/elastic/docs-builder/docs/4300/manage-data/lifecycle/index-lifecycle-management/rollover) process.
Each new backing index starts at the previous index's `end_time` and extends further ahead using `look_ahead_time`.
When you add a document to the TSDS, Elasticsearch routes it to the appropriate backing index based on its `@timestamp` value.
This means a TSDS can write to multiple backing indices simultaneously, not only the most recent one.
![Time bound indices](https://www.elastic.co/elastic/docs-builder/docs/4300/manage-data/images/elasticsearch-reference-time-bound-indices.svg)

Late-arriving data can still be indexed into an older backing index, as long as that index exists, remains writable, and its accepted time range includes the timestamp.
To inspect the accepted time ranges of TSDS backing indices, use the [get data stream API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream):
```json
```

By default, if no existing backing index can accept a document's `@timestamp`, Elasticsearch rejects the document.
Elasticsearch does not create missing past backing indices unless you [turn on past index creation](#tsds-past-index-creation).
<tip>
  Writes might still be rejected even when a timestamp fits the accepted time range of a backing index. The following [actions](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-lifecycle-actions) can affect the writable time range, either because they make a backing index read-only or remove it:
  - [Delete](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-lifecycle-actions/ilm-delete)
  - [Downsample](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-lifecycle-actions/ilm-downsample)
  - [Force merge](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-lifecycle-actions/ilm-forcemerge)
  - [Read only](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-lifecycle-actions/ilm-readonly)
  - [Searchable snapshot](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-lifecycle-actions/ilm-searchable-snapshot)
  - [Shrink](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-lifecycle-actions/ilm-shrink), which might revert the read-only status at the end of the action
  Index lifecycle management will **not** proceed with running these actions until [`index.time_series.end_time`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-settings/time-series#index-time-series-end-time) has passed.
</tip>


## Past index creation

<applies-to>
  - Elastic Stack: Generally available since 9.5
</applies-to>

In addition to accepted time ranges for each backing index, a time series data stream has an _eligible write window_.
It is the period of time that extends from the present back to whichever comes first:
- the first lifecycle action that makes a backing index read-only (such as [downsampling](https://www.elastic.co/elastic/docs-builder/docs/4300/manage-data/data-store/data-streams/downsampling-time-series-data-stream) or a searchable snapshot transition), or
- the data stream retention limit (configured in a [data stream lifecycle](https://www.elastic.co/elastic/docs-builder/docs/4300/manage-data/lifecycle/data-stream), for example)

Elasticsearch can
automatically create missing past backing indices for an existing time series data stream while indexing documents that fall within the eligible write window. To enable this, set the [`data_stream.past_tsdb_index_creation_enabled`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/configuration-reference/miscellaneous-cluster-settings#time-series-data-stream) cluster setting to `true`.
Timestamps outside the eligible write window or in the future are still rejected.
If a [failure store](https://www.elastic.co/elastic/docs-builder/docs/4300/manage-data/data-store/data-streams/failure-store) is enabled, rejected timestamp failures can be redirected there.
<admonition title="Lifecycle age for past indices">
  Past backing indices hold old data but are new indices.
  Elasticsearch sets [`index.lifecycle.origination_date`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/configuration-reference/data-stream-lifecycle-settings#index-data-stream-lifecycle-origination-date) from `index.time_series.end_time` so that data stream lifecycle and [index lifecycle management](https://www.elastic.co/elastic/docs-builder/docs/4300/manage-data/lifecycle/index-lifecycle-management) treat the index age based on the data it contains, not when the index was created.
</admonition>

Each new past backing index covers a configurable time interval.
Use the [`data_streams.past_tsdb_index_interval`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/configuration-reference/miscellaneous-cluster-settings#time-series-data-stream) cluster setting to control the interval.
When the gap between existing indices is up to 1.3 times the configured interval, Elasticsearch might create a single bridging index instead of many small indices.
For guidance on loading historical data, refer to [Load historical data into a TSDS](https://www.elastic.co/elastic/docs-builder/docs/4300/manage-data/data-store/data-streams/load-historical-tsds).

## Dimension-based routing

In addition to time-based routing, time series data streams use dimension-based routing to determine which shard to route data to. Documents with the same dimensions are routed to the same shards, using one of two strategies:
<definitions>
  <definition term="Index dimensions Elastic Stack: Generally available since 9.2 Elastic Cloud Serverless: Generally available">
    Routing based on the internally managed `index.dimensions` setting.
  </definition>
  <definition term="Routing path">
    Routing based on the [`index.routing_path`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-settings/time-series#index-routing-path)  setting (as a fallback).
  </definition>
</definitions>

The `index.dimensions`-based strategy offers better ingest performance. It uses a list of dimension paths that is automatically updated (and is not user-configurable). This strategy is not available for time series data streams with dynamic templates that set `time_series_dimension: true`.
To disable routing based on `index.dimensions`, set [`index.index_dimensions_tsid_strategy_enabled`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-settings/time-series#index-dimensions-tsid-strategy-enabled) to `false`,
or manually set the [`index.routing_path`](https://docs-v3-preview.elastic.dev/elastic/docs-builder/docs/4300/reference/elasticsearch/index-settings/time-series#index-routing-path) to the dimensions you want to use:
```json
"settings": {
  "index.mode": "time_series",
  "index.routing_path": ["host", "service"]
}
```

Documents with the same dimension values are routed to the same shard, improving compression and query performance for time series data.
The `index.routing_path` setting supports wildcards (for example, `dim.*`) and can dynamically match new fields.