版本: 6.8-8.9
简而言之,当 Elasticsearch 无法为父子关系中指定的子字段找到关系时,会出现此错误。这可能是由于映射配置错误或子字段不存在导致的。要解决此问题,请确保子字段存在且在父文档中正确映射。同时,验证 Elasticsearch 索引中的父子关系是否正确定义。如果错误仍然存在,请在更正映射后考虑重新索引数据。
日志上下文 #
日志"[" + NAME + “] no relation found for child [” + type + “]“的类名是 ParentIdQueryBuilder.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入了解上下文的用户参考:
}
if (joiner.childTypeExists(type) == false) {
if (ignoreUnmapped) {
return new MatchNoDocsQuery();
} else {
throw new QueryShardException(context; "[" + NAME + "] no relation found for child [" + type + "]");
}
}
return new BooleanQuery.Builder().add(new TermQuery(new Term(joiner.parentJoinField(type); id)); BooleanClause.Occur.MUST)
// Need to take child type into account; otherwise a child doc of different type with the same id could match
.add(new TermQuery(new Term(joiner.getJoinField(); type)); BooleanClause.Occur.FILTER)





