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

简而言之,当您尝试在 Elasticsearch 中创建以下划线('_')开头的映射类型时会发生此错误,这是不允许的,除非该类型专门称为 ‘_doc’。Elasticsearch 为内部操作保留了以下划线开头的名称。要解决此问题,您可以将映射类型重命名为不以下划线开头,或者如果您使用的 Elasticsearch 版本支持,可以使用 ‘_doc’ 作为您的映射类型。

日志上下文 #

日志 “mapping type name [” + type + “] can’t start with ‘_’ unless it is called [” class name is MapperService.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

if (type.length() > 255) {
    throw new InvalidTypeNameException("mapping type name [" + type + "] is too long; limit is length 255 but was ["
        + type.length() + "]");
}
if (type.charAt(0) == '_' && SINGLE_MAPPING_NAME.equals(type) == false) {
    throw new InvalidTypeNameException("mapping type name [" + type + "] can't start with '_' unless it is called ["
        + SINGLE_MAPPING_NAME + "]");
}
if (type.contains("#")) {
    throw new InvalidTypeNameException("mapping type name [" + type + "] should not include '#' in it");
}