版本: 6.8-6.8
简要来说,当您尝试在 Elasticsearch 6.x 或更高版本中使用 [_parent] 字段时会出现此错误,这些版本已取消对每个索引多个类型的支持。[_parent] 字段用于在同一索引中不同类型的文档之间建立父子关系。要解决此问题,您可以使用 “join” 字段来建模父子关系,或者重组数据结构以避免对父子关系的需求。或者,如果父子关系不是至关重要的,您可以为每个类型使用单独的索引。
日志上下文 #
日志 “[_parent] field is disabled on indices with a single type.” 的类名是 ParentFieldMapper.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景的人参考:
} @Override
public ParentFieldMapper build(BuilderContext context) {
if (context.indexCreatedVersion().onOrAfter(Version.V_6_5_0)) {
throw new MapperParsingException("[_parent] field is disabled on indices with a single type. " +
"Use a [join] field instead.");
}
if (parentType == null) {
throw new MapperParsingException("[_parent] field mapping must contain the [type] option");
}





