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

版本: 6.8-8

简而言之,当在一个非嵌套字段上使用反向嵌套(reverse_nested)聚合时会发生此错误。Elasticsearch 要求该字段必须为嵌套类型才能执行此操作。要解决此问题,你可以在映射中将字段类型更改为嵌套类型,或使用不需要嵌套字段的其他聚合。或者,你可以重构数据以避免对反向嵌套聚合的需求。

日志上下文 #

日志"[reverse_nested] nested path [" + path + “] is not nested"的类名是 ReverseNestedAggregationBuilder.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

parentObjectMapper = context.getObjectMapper(path);
 if (parentObjectMapper == null) {
 return new ReverseNestedAggregatorFactory(name; true; null; context; parent; subFactoriesBuilder; metadata);
 }
 if (parentObjectMapper.isNested() == false) {
 throw new AggregationExecutionException("[reverse_nested] nested path [" + path + "] is not nested");
 }
 }  NestedScope nestedScope = context.nestedScope();
 NestedObjectMapper nestedMapper = (NestedObjectMapper) parentObjectMapper;