--- title: "Span within 查询不支持 currentFieldName – 如何解决此 Elasticsearch 异常" date: 2026-01-15 lastmod: 2026-01-15 description: "当在 Elasticsearch 的 span_within 查询中使用了不支持的字段时会触发此错误。span_within 查询仅支持 'big' 和 'little' 字段,使用其他字段会导致此异常。" tags: ["span_within查询", "查询异常", "字段限制", "解析错误"] summary: "版本: 6.8-8.9 简而言之,当在 Elasticsearch 的 [span_within] 查询中使用了不支持的字段时,会发生此错误。[span_within] 查询仅支持"big"和"little"字段。如果您使用任何其他字段,将抛出此错误。要解决此问题,您应该检查查询并确保仅使用支持的字段。如果您试图使用 [span_within] 不支持的功能,请考虑使用支持所需功能的其他类型的查询。 日志上下文 # 日志"[span_within] query does not support [" + currentFieldName + “]“的类名是 SpanWithinQueryBuilder.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解的人参考: } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName; parser.getDeprecationHandler())) { boost = parser.floatValue(); } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName; parser.getDeprecationHandler())) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(); "[span_within] query does not support [" + currentFieldName + "]"); } } if (big == null) { throw new ParsingException(parser." --- > **版本:** 6.8-8.9 简而言之,当在 Elasticsearch 的 [span_within] 查询中使用了不支持的字段时,会发生此错误。[span_within] 查询仅支持"big"和"little"字段。如果您使用任何其他字段,将抛出此错误。要解决此问题,您应该检查查询并确保仅使用支持的字段。如果您试图使用 [span_within] 不支持的功能,请考虑使用支持所需功能的其他类型的查询。 日志上下文 ----------- 日志"[span\_within] query does not support [" + currentFieldName + "]"的类名是 [SpanWithinQueryBuilder.java.](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解的人参考: ```java } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName; parser.getDeprecationHandler())) { boost = parser.floatValue(); } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName; parser.getDeprecationHandler())) { queryName = parser.text(); } else { 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]"); ```