版本: 6.8-8.9
简而言之,当Elasticsearch在文档中遇到索引映射中未定义的字段时,就会出现此错误。这可能是由于字段名拼写错误或尝试在未更新映射的情况下索引包含新字段的文档造成的。要解决此问题,您可以更正文档中的字段名(如果是拼写错误),或者在索引文档之前更新索引映射以包含新字段。或者,您可以在索引设置中设置"dynamic": “true"以自动将新字段添加到映射中。
日志上下文 #
日志"unknown field found"的类名是 XContentParserUtils.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用:
throw new ParsingException(parser.getTokenLocation(), String.format(Locale.ROOT, message, fieldName, currentName));
}
} /**
* @throws ParsingException with a "unknown field found" reason
*/
public static void throwUnknownField(String field, XContentParser parser) {
String message = "Failed to parse object: unknown field [%s] found";
throw new ParsingException(parser.getTokenLocation(), String.format(Locale.ROOT, message, field));
}





