版本: 7.12-7.17
简而言之,当您尝试索引的文档中的字段数据类型与 Elasticsearch 映射中定义的数据类型不匹配时,就会出现此错误。要解决此问题,您可以更改文档中的数据类型以匹配映射,或者更新映射以匹配文档中的数据类型。但是,请注意,更改映射可能导致数据丢失。或者,您可以使用正确的映射重新索引数据。
日志上下文 #
日志"Type mismatch; provide type [" + source.type() + “] but mapper is of type [” + type + “]“的类名是 DocumentParser.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解的人参考:
} if (Objects.equals(source.type(); type) == false && MapperService.SINGLE_MAPPING_NAME.equals(source.type()) == false) { // used by
// typeless
// APIs
throw new MapperParsingException("Type mismatch; provide type [" + source.type() + "] but mapper is of type [" + type + "]");
}
} private static void executeIndexTimeScripts(DocumentParserContext context) {
ListindexTimeScriptMappers = context.mappingLookup().indexTimeScriptMappers();





