版本: 6.8-8.9
简而言之,当 Elasticsearch 无法在指定路径下定位到嵌套对象时,就会出现此错误。这可能是由于路径拼写错误,或者对象可能不存在。要解决此问题,您可以验证路径并确保嵌套对象存在。如果对象不存在,您需要创建它。如果路径不正确,请予以更正。此外,确保您尝试访问的字段类型为 ‘nested’。如果不是,您需要使用正确的映射重新索引数据。
日志上下文 #
日志"[nested] failed to find nested object under path [" + nestedPath + “]“的类名是 SortBuilder.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用:
NestedSortBuilder nestedNestedSort = nestedSort.getNestedSort(); // 验证我们的嵌套路径
NestedObjectMapper nestedObjectMapper = context.nestedLookup().getNestedMappers().get(nestedPath);
if (nestedObjectMapper == null) {
throw new QueryShardException(context, "[nested] failed to find nested object under path [" + nestedPath + "]");
}
NestedObjectMapper parentMapper = context.nestedScope().getObjectMapper(); // 获取我们的子查询;可能应用用户过滤器
Query childQuery;





