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

版本: 6.8-6.8

简而言之,当 Elasticsearch 无法为指定的父类型找到任何子类型时,就会出现此错误。这可能是由于映射不正确或子类型未正确定义导致的。要解决此问题,您可以检查索引的映射以确保父子关系正确定义。此外,确保子类型存在并正确链接到父类型。如果错误仍然存在,您可能需要使用正确的映射重新索引数据。

日志上下文 #

日志 “[ " + NAME + " ] no child types found for type [ " + type + " ]” 的类名是 HasParentQueryBuilder.java。 我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入背景的人提供参考:

if (parentFieldMapper.active() && type.equals(parentFieldMapper.type())) {
 childTypes.add(documentMapper.type());
 }
 }
 if (childTypes.isEmpty()) {
 throw new QueryShardException(context; "[" + NAME + "] no child types found for type [" + type + "]");
 }  Query childrenQuery;
 if (childTypes.size() == 1) {
 DocumentMapper documentMapper = context.getMapperService().documentMapper(childTypes.iterator().next());