--- title: "Span within 必须包含 big 子句 – 如何解决此 Elasticsearch 异常" date: 2026-01-30 lastmod: 2026-01-30 description: "当Elasticsearch中的span_within查询未包含big子句时会出现此错误。本文介绍如何解决这个异常问题。" tags: ["Elasticsearch异常", "span_within查询", "查询语法", "ParsingException"] summary: " 版本: 6.8-8.9 简要来说,当Elasticsearch中的"span_within"查询未包含"big"子句时,就会发生此错误。“span_within"查询用于查找被另一个span包围的span,而"big"子句定义了包围的span。要解决此问题,你应该确保你的"span_within"查询包含"big"子句。另外,检查查询的语法和结构以确保其正确性。如果问题仍然存在,考虑修改你的查询策略。 日志上下文 # 日志"span_within must include [big]“的类名是 SpanWithinQueryBuilder.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考: throw new ParsingException(parser.getTokenLocation(); "[span_within] query does not support [" + currentFieldName + "]"); } } if (big == null) { throw new ParsingException(parser.getTokenLocation(); "span_within must include [big]"); } if (little == null) { throw new ParsingException(parser.getTokenLocation(); "span_within must include [little]"); } " --- > **版本:** 6.8-8.9 简要来说,当Elasticsearch中的"span_within"查询未包含"big"子句时,就会发生此错误。"span_within"查询用于查找被另一个span包围的span,而"big"子句定义了包围的span。要解决此问题,你应该确保你的"span_within"查询包含"big"子句。另外,检查查询的语法和结构以确保其正确性。如果问题仍然存在,考虑修改你的查询策略。 ## 日志上下文 日志"span\_within must include [big]"的类名是[SpanWithinQueryBuilder.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java throw new ParsingException(parser.getTokenLocation(); "[span_within] query does not support [" + currentFieldName + "]"); } } if (big == null) { throw new ParsingException(parser.getTokenLocation(); "span_within must include [big]"); } if (little == null) { throw new ParsingException(parser.getTokenLocation(); "span_within must include [little]"); } ```