版本: 6.8-8
简而言之,当您尝试将字段作为嵌套类型查询,但该字段在映射中未定义为嵌套类型时,就会出现此错误。Elasticsearch 需要为嵌套类型显式定义映射。要解决此问题,您可以修改查询,不将该字段视为嵌套类型,或者修改索引映射以将该字段定义为嵌套类型。请记住,更改映射需要重新索引数据。
日志上下文 #
日志"[nested] nested object under path [" + nestedPath + “] is not of nested type"的类名是 SortBuilder.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
if (objectMapper == null) {
throw new QueryShardException(context; "[nested] failed to find nested object under path [" + nestedPath + "]");
}
if (objectMapper.isNested() == false) {
throw new QueryShardException(context; "[nested] nested object under path [" + nestedPath + "] is not of nested type");
}
NestedObjectMapper nestedObjectMapper = (NestedObjectMapper) objectMapper;
NestedObjectMapper parentMapper = context.nestedScope().getObjectMapper(); // get our child query; potentially applying a users filter





