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

简而言之,当 Elasticsearch 中的映射类型名称超过最大允许长度 255 个字符时,就会发生此错误。Elasticsearch 使用映射来定义文档如何索引以及其字段如何存储和索引。要解决此问题,您可以将映射类型名称缩短至小于或等于 255 个字符。或者,您可以重构数据模型以降低映射类型的复杂性,这可能会导致更短的类型名称。

日志上下文 #

日志 “mapping type name [” + type + “] is too long; limit is length 255 but was [” 类名是 MapperService.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

static void validateTypeName(String type) {
    if (type.length() == 0) {
        throw new InvalidTypeNameException("mapping type name is empty");
    }
    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 + "]");