{"record":{"id":"9df96bd14cb37ce8","repo":"elastic/elasticsearch","slug":"cannot-create-past-tsdb-backing-index-for-data-str-9df96b","errorCode":null,"errorMessage":"Cannot create past TSDB backing index for data stream [{}] with mode [{}], it needs to be a time series data stream.","messagePattern":"Cannot create past TSDB backing index for data stream \\[(.+?)\\] with mode \\[(.+?)\\], it needs to be a time series data stream\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportPastTimeSeriesIndexCreationAction.java","lineNumber":529,"sourceCode":"\n        CoveredTimeWindow(Instant start, Instant end) {\n            this(start.toEpochMilli(), end.toEpochMilli());\n        }\n    }\n\n    private static void validateDataStream(String dataStreamName, DataStream dataStream, ProjectMetadata project) {\n        if (dataStream == null) {\n            throw new ResourceNotFoundException(\"Data stream [\" + dataStreamName + \"] not found\");\n        }\n        if (dataStream.isReplicated()) {\n            throw new IllegalArgumentException(\"Cannot create past TSDB backing index for replicated data stream [\" + dataStreamName + \"]\");\n        }\n        if (dataStream.isSystem()) {\n            throw new IllegalArgumentException(\"Cannot create past TSDB backing index for system data stream [\" + dataStreamName + \"]\");\n        }\n\n        if (IndexMode.isTsdb(dataStream.getIndexMode()) == false) {\n            throw new IllegalArgumentException(\n                \"Cannot create past TSDB backing index for data stream [\"\n                    + dataStreamName\n                    + \"] with mode [\"\n                    + dataStream.getIndexMode()\n                    + \"], it needs to be a time series data stream.\"\n            );\n        }\n        Index writeIndex = dataStream.getWriteIndex();\n        IndexMetadata writeIndexMetadata = writeIndex == null ? null : project.index(writeIndex);\n        if (writeIndexMetadata == null || IndexMode.isTsdb(writeIndexMetadata.getIndexMode()) == false) {\n            throw new IllegalStateException(\n                \"Cannot create past TSDB backing index for data stream [\"\n                    + dataStreamName\n                    + \"] because it requires to have yet at least one time series backing index. Please rollover first.\"\n            );\n        }\n    }\n","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/TransportPastTimeSeriesIndexCreationAction.java#L511-L547","documentation":"Thrown by validateDataStream in the past-TSDB-backing-index creation action when the targeted data stream's index mode is not 'time_series'. The API exists only to create time series (TSDB) backing indices that pre-date the stream's first index, so a non-TSDB stream is an argument error (IllegalArgumentException). The message reports the actual mode so the caller can see the mismatch.","triggerScenarios":"Calling the past TSDB index creation transport action (TransportPastTimeSeriesIndexCreationAction) for a data stream whose DataStream#indexMode returns anything other than a TSDB mode (e.g. STANDARD, LOGSDB, LOGS). The check IndexMode.isTsdb(dataStream.getIndexMode()) == false fires before any backing index is built.","commonSituations":"Index template omitted 'index.mode: time_series' so the stream was created as a standard/logs data stream; calling the API against a logs data stream by mistake; migrating from a standard stream without recreating it as TSDB; copy/paste of the wrong data stream name.","solutions":["Verify the mode with GET _data_stream/<name> and confirm index.mode is time_series","Create a new data stream backed by a composable index template that sets index.mode: time_series (and the required time_series dimensions/mappings)","Reindex or re-ingest the data into the correctly configured TSDB data stream, then retry the past-index creation against it"],"exampleFix":"// before\nPUT _index_template/my-template\n{ \"template\": { \"settings\": {} }, ... } // missing index.mode\n// after\nPUT _index_template/my-template\n{ \"template\": { \"settings\": { \"index.mode\": \"time_series\", \"index.routing_path\": [\"host\"] } }, ... }","handlingStrategy":"validation","validationCode":"// Before calling the past-TSDB-index API, confirm the stream is TSDB:\n// GET _data_stream/<name> -> check index.mode == 'time_series'\nString mode = getDataStreamIndexMode(name);\nif (!\"time_series\".equals(mode)) {\n    throw new IllegalStateException(\"Cannot create past TSDB index: stream mode is \" + mode);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize data-stream creation behind a helper that always sets index.mode: time_series for metrics streams","Add a pre-flight GET _data_stream check in automation that calls the past-index API","Document which streams are TSDB-eligible in your inventory"],"tags":["tsdb","data-streams","time-series","validation","index-mode"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}