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

版本: 6.8-7.15

简而言之,当 Elasticsearch 期望请求体中包含某个字段,但该字段未提供时,就会发生此错误。这可能是由于字段名拼写错误或请求中完全缺少该字段造成的。要解决此问题,请确保请求中的字段名与 Elasticsearch 期望的字段名完全匹配。同时,检查请求中是否缺少该字段。如果该字段是可选的且您不想提供它,请确保不包含该字段的请求格式正确。

日志上下文 #

日志 “expected field [” 的类名是 PercolateQueryBuilder.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入理解的人参考:

if (fieldType == null) {
    throw new QueryShardException(context, "field [" + field + "] does not exist");
}
if ((fieldType instanceof PercolatorFieldMapper.PercolatorFieldType) == false) {
    throw new QueryShardException(context, "expected field [" + field +
    "] to be of type [percolator]; but is of type [" + fieldType.typeName() + "]");
}
final List<ParsedDocument> docs = new ArrayList<>();
String type = context.getType();