版本: 6.8-8.9
简而言之,当 Elasticsearch 尝试在索引映射中不存在的字段上执行搜索或操作时,会出现此错误。这可能是由于字段名拼写错误或字段未被索引造成的。要解决此问题,您可以检查字段名是否存在拼写错误,确保字段包含在索引映射中,或者如果字段是在初始索引之后添加的,则重新索引数据。如果该字段不是必需的,您还可以修改查询以排除它。
日志上下文 #
日志"No field mapping can be found for the field with name [{}]“的类名是 LookupRuntimeFieldType.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景信息的人参考:
LookupFieldValueFetcher(SearchExecutionContext context) {
final MappedFieldType inputFieldType = context.getFieldType(inputField);
// do not allow unmapped field
if (inputFieldType == null) {
throw new QueryShardException(context; "No field mapping can be found for the field with name [{}]"; inputField);
}
this.inputFieldValueFetcher = inputFieldType.valueFetcher(context; null);
} @Override





