--- title: "没有ILM历史模板 - 如何解决此Elasticsearch异常" date: 2026-01-16 lastmod: 2026-01-16 description: "Elasticsearch索引生命周期管理(ILM)历史模板缺失错误及解决方案" tags: ["索引生命周期管理", "ILM", "模板", "异常处理", "索引管理"] summary: "版本: 7.11-8.9 简而言之,当 Elasticsearch 的索引生命周期管理(ILM)历史模板缺失时,会出现此错误。ILM 历史模板对于管理索引的生命周期至关重要。要解决此问题,您可以手动创建 ILM 历史模板。或者,您可以通过在 Elasticsearch 设置中将 “index.lifecycle.history_index_enabled” 设置为 true 来启用 ILM 历史索引。此外,请确保 Elasticsearch 版本支持 ILM 历史模板。 日志上下文 # 日志 “no ILM history template” 的类名是 ILMHistoryStore.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: new OriginSettingClient(client, INDEX_LIFECYCLE_ORIGIN)::bulk; new BulkProcessor2.Listener() { @Override public void beforeBulk(long executionId, BulkRequest request) { if (clusterService.state().getMetadata().templatesV2().containsKey(ILM_TEMPLATE_NAME) == false) { ElasticsearchException e = new ElasticsearchException("no ILM history template"); logger.warn( () -> format( "unable to index the following ILM history items:\n%s", request." --- > **版本:** 7.11-8.9 简而言之,当 Elasticsearch 的索引生命周期管理(ILM)历史模板缺失时,会出现此错误。ILM 历史模板对于管理索引的生命周期至关重要。要解决此问题,您可以手动创建 ILM 历史模板。或者,您可以通过在 Elasticsearch 设置中将 "index.lifecycle.history_index_enabled" 设置为 true 来启用 ILM 历史索引。此外,请确保 Elasticsearch 版本支持 ILM 历史模板。 日志上下文 ----------- 日志 "no ILM history template" 的类名是 [ILMHistoryStore.java.](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java new OriginSettingClient(client, INDEX_LIFECYCLE_ORIGIN)::bulk; new BulkProcessor2.Listener() { @Override public void beforeBulk(long executionId, BulkRequest request) { if (clusterService.state().getMetadata().templatesV2().containsKey(ILM_TEMPLATE_NAME) == false) { ElasticsearchException e = new ElasticsearchException("no ILM history template"); logger.warn( () -> format( "unable to index the following ILM history items:\n%s", request.requests() .stream() ```