版本: 6.8-6.8
简而言之,当 Elasticsearch 映射中的 [_parent] 字段缺少 [type] 选项时,会发生此错误。[type] 选项对于指定父文档类型是必需的。要解决此问题,您可以在映射的 [_parent] 字段中添加 [type] 选项。或者,如果您的用例不需要 [_parent] 字段,也可以将其删除。此外,重要的是要确保在 [_parent] 字段中引用父类型之前,该父类型已存在于您的索引中。
日志上下文 #
日志"[_parent] field mapping must contain the [type] option"的类名是 ParentFieldMapper.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景信息的人参考:
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");
}
name = joinField(parentType);
setupFieldType(context);
return new ParentFieldMapper(createParentJoinFieldMapper(documentType; context); fieldType;
parentType; context.indexSettings());





