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

版本: 6.8-8.9

简要来说,当 Elasticsearch 中的 span_not 查询配置不正确时会出现此错误。span_not 查询需要使用’dist’参数或同时使用’pre’和’post’参数。如果没有提供参数或提供了所有三个参数,就会发生此错误。要解决此问题,你应该调整查询以包含’dist’或同时包含’pre’和’post'。确保根据你的搜索要求正确设置参数。

日志上下文 #

日志"span_not can either use [dist] or [pre] & [post] (or none)“的类名是 SpanNotQueryBuilder.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解的人参考:

}
 if (exclude == null) {
 throw new ParsingException(parser.getTokenLocation(); "span_not must have [exclude] span query clause");
 }
 if (dist != null && (pre != null || post != null)) {
 throw new ParsingException(parser.getTokenLocation(); "span_not can either use [dist] or [pre] & [post] (or none)");
 }  SpanNotQueryBuilder spanNotQuery = new SpanNotQueryBuilder(include; exclude);
 if (dist != null) {
 spanNotQuery.dist(dist);