elastic/elasticsearch · error · IllegalArgumentException
Cannot create past TSDB backing index for replicated data st
Error message
Cannot create past TSDB backing index for replicated data stream [{}] What it means
Thrown by validateDataStream when the data stream exists but isReplicated() returns true (a cross-cluster-replication follower data stream). Past TSDB backing index creation is a write operation that must run on the leader; follower streams are read-only replicas and cannot have new backing indices minted on the follower side.
Source
Thrown at modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportPastTimeSeriesIndexCreationAction.java:522
public void init() {
clusterService.getClusterSettings()
.addSettingsUpdateConsumer(PAST_TSDB_INDEX_INTERVAL, tv -> indexIntervalMillis = tv.millis());
}
}
record CoveredTimeWindow(long start, long end) {
CoveredTimeWindow(Instant start, Instant end) {
this(start.toEpochMilli(), end.toEpochMilli());
}
}
private static void validateDataStream(String dataStreamName, DataStream dataStream, ProjectMetadata project) {
if (dataStream == null) {
throw new ResourceNotFoundException("Data stream [" + dataStreamName + "] not found");
}
if (dataStream.isReplicated()) {
throw new IllegalArgumentException("Cannot create past TSDB backing index for replicated data stream [" + dataStreamName + "]");
}
if (dataStream.isSystem()) {
throw new IllegalArgumentException("Cannot create past TSDB backing index for system data stream [" + dataStreamName + "]");
}
if (IndexMode.isTsdb(dataStream.getIndexMode()) == false) {
throw new IllegalArgumentException(
"Cannot create past TSDB backing index for data stream ["
+ dataStreamName
+ "] with mode ["
+ dataStream.getIndexMode()
+ "], it needs to be a time series data stream."
);
}
Index writeIndex = dataStream.getWriteIndex();
IndexMetadata writeIndexMetadata = writeIndex == null ? null : project.index(writeIndex);
if (writeIndexMetadata == null || IndexMode.isTsdb(writeIndexMetadata.getIndexMode()) == false) {
throw new IllegalStateException(View on GitHub (pinned to db6a809a66)
Solutions
- Run the past TSDB index creation request against the leader data stream, not the replicated follower.
- Filter replicated streams out of any bulk/batch backfill job using the is_replicated flag from GET _data_stream.
Defensive patterns
Strategy: validation
Validate before calling
if (dataStream.isReplicated()) {
throw new IllegalArgumentException("Cannot create past TSDB backing index for replicated data stream");
} Prevention
- Run past TSDB index creation on the leader cluster only.
- Filter is_replicated=true streams out of batch backfill jobs.
When it happens
Trigger: Calling the past TSDB index creation API on a data stream that is a CCR follower. The check runs right after the not-found check and before the tsdb-mode check.
Common situations: Operating on the follower cluster instead of the leader; automation that targets all streams without filtering out replicated ones.
Related errors
- Cannot create past TSDB backing index for data stream [{}] b
- Data stream [{}] not found
- Cannot create past TSDB backing index for system data stream
- backing index [%s] in tsdb mode doesn't have the [%s] index
- Cannot add dynamic templates that define dimension fields on
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/592e0b2dd697421b.
Report an issue: GitHub.