版本: 7.11-8.9
简要来说,当 Elasticsearch 尝试自动创建一个匹配可组合模板的索引时,如果模板设置禁止自动创建,就会发生此错误。这可能是由于模板设置配置不当造成的。要解决此问题,您可以修改模板设置以允许索引自动创建,或者在索引数据之前手动创建索引。此外,如果您的用例不需要索引自动创建,也可以在 Elasticsearch 设置中禁用此功能。
日志上下文 #
日志 “composable template " + template.indexPatterns() + " forbids index auto creation” 的类名是 AutoCreateIndex.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入上下文的用户参考:
if (template != null && template.getAllowAutoCreate() != null) {
if (template.getAllowAutoCreate()) {
return true;
} else {
// 显式的 false 值会覆盖 AUTO_CREATE_INDEX_SETTING
throw new IndexNotFoundException("composable template " + template.indexPatterns() + " forbids index auto creation");
}
}
// 一次 volatile 读取;以便所有检查都针对同一个实例:
final AutoCreate autoCreate = this.autoCreate;





