版本: 7.11-7.15
简而言之,当 Elasticsearch 期望使用映射(一种由键值对组成的数据结构)来定义运行时字段,但它收到了不同的数据类型时,就会出现此错误。这可能是由于不正确的数据输入或预期的数据结构不匹配导致的。要解决此问题,请确保运行时字段定义正确格式化为映射。此外,检查输入的数据类型以确保其与预期的映射结构相匹配。如果错误仍然存在,请检查您的 Elasticsearch 架构是否存在潜在的不一致。
日志上下文 #
日志 “Expected map for runtime field [” + fieldName + “] definition but got a ” 的类名是 RuntimeField.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景的人参考:
runtimeFields.put(fieldName, builder.apply(typeParser.parse(fieldName, propNode, parserContext)));
propNode.remove("type");
MappingParser.checkNoRemainingFields(fieldName, propNode);
iterator.remove();
} else {
throw new MapperParsingException("Expected map for runtime field [" + fieldName + "] definition but got a "
+ entry.getValue().getClass().getName());
}
}
return Collections.unmodifiableMap(runtimeFields);
}





