📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-6.8

简要来说,当Elasticsearch尝试自动创建不存在的索引,但自动创建索引设置被设为false时,会出现此错误。该设置会阻止Elasticsearch自动创建索引。要解决此问题,您可以在向索引添加文档之前手动创建索引,或者将自动创建索引设置更改为true,允许Elasticsearch根据需要自动创建索引。但请注意,如果使用了错误的索引名称,允许自动创建索引可能会导致意外的索引创建。

日志上下文 #

日志 “no such index and [” + AUTO_CREATE_INDEX_SETTING.getKey() + “] is [false]” 的类名是 AutoCreateIndex.java. 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

return false;
 }
 // One volatile read; so that all checks are done against the same instance:
 final AutoCreate autoCreate = this.autoCreate;
 if (autoCreate.autoCreateIndex == false) {
 throw new IndexNotFoundException("no such index and [" + AUTO_CREATE_INDEX_SETTING.getKey() + "] is [false]", index);
 }
 if (dynamicMappingDisabled) {
 throw new IndexNotFoundException("no such index and [" + MapperService.INDEX_MAPPER_DYNAMIC_SETTING.getKey() + "] is [false]";
 index);
 }