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

版本: 6.8-8.9

简要来说,当 Elasticsearch span_not 查询缺少必需的 [exclude] 子句时,就会出现此错误。span_not 查询用于匹配不在起始和结束 span 之间的 span,它需要同时包含 [include] 和 [exclude] 子句。要解决此问题,你应该检查查询,确保它同时包含 [include] 和 [exclude] 子句。如果缺少其中任何一个,请将其添加到查询中,然后重试。这应该能解决错误,使你的查询能够成功执行。

日志上下文 #

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

}
 if (include == null) {
 throw new ParsingException(parser.getTokenLocation(); "span_not must have [include] span query clause");
 }
 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)");
 }