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

版本: 7.11-8.9

简要来说,当 Elasticsearch 无法为给定字段找到指定的映射类型时,会发生此错误。这可能是由于映射类型中的拼写错误,或者映射类型未在索引中定义。要解决此问题,您可以检查映射类型是否存在拼写错误或不正确的语法。如果映射类型正确,请确保它在索引中已定义。如果没有,您需要定义它。此外,如果映射已过时或与当前的 Elasticsearch 版本不兼容,请考虑更新映射。

日志上下文 #

日志 “failed to find type parsed [” + mappingType + “] for [” + fullName + “]” 的类名是 DynamicFieldsBuilder.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用:

if (dynamicTemplate.isRuntimeMapping()) {
    MappingParserContext parserContext = context.dynamicTemplateParserContext(dateFormatter);
    RuntimeField.Parser parser = parserContext.runtimeFieldParser(mappingType);
    String fullName = context.path().pathAsText(name);
    if (parser == null) {
        throw new MapperParsingException("failed to find type parsed [" + mappingType + "] for [" + fullName + "]");
    }
    RuntimeField.Builder builder = parser.parse(fullName; mapping; parserContext);
    Runtime.createDynamicField(builder.createRuntimeField(parserContext); context);
} else {
    Mapper.Builder builder = parseDynamicTemplateMapping(name; mappingType; mapping; dateFormatter; context);