{"record":{"id":"c6195925f3161288","repo":"elastic/elasticsearch","slug":"backing-index-s-in-tsdb-mode-doesn-t-have-the","errorCode":null,"errorMessage":"backing index [%s] in tsdb mode doesn't have the [%s] index setting","messagePattern":"backing index \\[(.+?)\\] in tsdb mode doesn't have the \\[(.+?)\\] index setting","errorType":"exception","errorClass":"IllegalStateException","httpStatus":500,"severity":"error","filePath":"modules/data-streams/src/main/java/org/elasticsearch/datastreams/DataStreamIndexSettingsProvider.java","lineNumber":123,"sourceCode":"                indexMode = isMigratingToTimeSeries ? dataStream.getIndexMode() : null;\n            } else if (isMigratingToTimeSeries) {\n                indexMode = IndexMode.TIME_SERIES;\n            } else {\n                indexMode = null;\n            }\n            if (indexMode != null) {\n                if (indexMode.isTsdb()) {\n                    TimeValue lookAheadTime = DataStreamsPlugin.getLookAheadTime(indexTemplateAndCreateRequestSettings);\n                    TimeValue lookBackTime = DataStreamsPlugin.LOOK_BACK_TIME.get(indexTemplateAndCreateRequestSettings);\n                    final Instant start;\n                    final Instant end;\n                    if (dataStream == null || migrating) {\n                        start = DataStream.getCanonicalTimestampBound(resolvedAt.minusMillis(lookBackTime.getMillis()));\n                        end = DataStream.getCanonicalTimestampBound(resolvedAt.plusMillis(lookAheadTime.getMillis()));\n                    } else {\n                        IndexMetadata currentLatestBackingIndex = projectMetadata.index(dataStream.getWriteIndex());\n                        if (currentLatestBackingIndex.getSettings().hasValue(IndexSettings.TIME_SERIES_END_TIME.getKey()) == false) {\n                            throw new IllegalStateException(\n                                String.format(\n                                    Locale.ROOT,\n                                    \"backing index [%s] in tsdb mode doesn't have the [%s] index setting\",\n                                    currentLatestBackingIndex.getIndex().getName(),\n                                    IndexSettings.TIME_SERIES_END_TIME.getKey()\n                                )\n                            );\n                        }\n                        start = IndexSettings.TIME_SERIES_END_TIME.get(currentLatestBackingIndex.getSettings());\n                        if (start.isAfter(resolvedAt)) {\n                            end = DataStream.getCanonicalTimestampBound(start.plusMillis(lookAheadTime.getMillis()));\n                        } else {\n                            end = DataStream.getCanonicalTimestampBound(resolvedAt.plusMillis(lookAheadTime.getMillis()));\n                        }\n                    }\n                    assert start.isBefore(end) : \"data stream backing index's start time is not before end time\";\n                    additionalSettings.put(IndexSettings.TIME_SERIES_START_TIME.getKey(), FORMATTER.format(start));\n                    additionalSettings.put(IndexSettings.TIME_SERIES_END_TIME.getKey(), FORMATTER.format(end));","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/data-streams/src/main/java/org/elasticsearch/datastreams/DataStreamIndexSettingsProvider.java#L105-L141","documentation":"Thrown by DataStreamIndexSettingsProvider when computing time-series bounds for an existing (non-migrating) tsdb data stream and the current write index lacks the index.time_series.end_time setting. The provider reads the previous backing index's end time as the new index's start; if that setting is absent it cannot chain the windows and throws IllegalStateException.","triggerScenarios":"A tsdb data stream whose backing index was created without time_series end_time (e.g. created outside the normal tsdb template, restored from an old snapshot, or created before the setting existed), then a new backing index is requested for that data stream.","commonSituations":"Restoring a tsdb data stream from a snapshot taken on an older version; manually creating a backing index that bypassed index_setting_providers; template drift where the tsdb mode is set but the lifecycle/bounds providers did not run.","solutions":["Rollover the data stream so a fresh backing index with correct time_series bounds is created.","Restore or recreate the backing index through the proper tsdb template so index.time_series.end_time is set.","If the index is stale/foreign, remove it from the data stream or reindex into a correctly-created backing index."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before triggering new backing-index creation, confirm the write index has time_series.end_time.\nconst settings = await es.indices.getSettings({ index: writeIndex });\nconst endTime = settings[writeIndex].settings['index.time_series.end_time'];\nif (!endTime) {\n  throw new Error(`backing index ${writeIndex} missing index.time_series.end_time; rollover first`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always create tsdb backing indices through the proper tsdb template/lifecycle so bounds are set.","After restore/upgrade, rollover before issuing further writes that depend on window chaining."],"tags":["data-streams","tsdb","time-series","index-settings","elasticsearch"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}