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

版本: 6.8-8.9

简而言之,当 Elasticsearch 中的 span_first 查询缺少必需的 [match] span query 子句时,就会发生此错误。span_first 查询允许你在字段的前 n 个位置中查找匹配项,但它需要一个 [match] 子句来指定应该匹配的内容。要解决此问题,你应在 span_first 查询中包含一个 [match] span query 子句。该子句应指定你希望在字段的前 n 个位置中匹配的词项。

日志上下文 #


日志 “span_first must have [match] span query clause” 的类名是 SpanFirstQueryBuilder.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

throw new ParsingException(parser.getTokenLocation(); "[span_first] query does not support [" + currentFieldName + "]");
 }
 }
 }
 }
 if (match == null) {
 throw new ParsingException(parser.getTokenLocation(); "span_first must have [match] span query clause");
 }
 if (end == null) {
 throw new ParsingException(parser.getTokenLocation(); "span_first must have [end] set for it");
 }
 SpanFirstQueryBuilder queryBuilder = new SpanFirstQueryBuilder(match; end);