版本: 7.11-8.9
简要来说,当在Elasticsearch中定义运行时字段时未指定其类型,就会发生此错误。运行时字段是Elasticsearch中的一种读时模式字段,它们需要指定类型才能正常工作。要解决此问题,应确保在Elasticsearch索引中定义的每个运行时字段都指定了类型。可以通过在映射中的运行时字段定义中添加"type"字段来实现。类型可以是’keyword'、‘long’、‘double’、‘date’等,具体取决于您存储的数据。
日志上下文 #
日志"No type specified for runtime field [" + fieldName + “]“的类名是 RuntimeField.java。 我们从Elasticsearch源代码中提取了以下内容,供寻求深入上下文的人员参考:
@SuppressWarnings("unchecked")
MappropNode = new HashMap<>(((Map) entry.getValue()));
Object typeNode = propNode.get("type");
String type;
if (typeNode == null) {
throw new MapperParsingException("No type specified for runtime field [" + fieldName + "]");
} else {
type = typeNode.toString();
}
Parser typeParser = parserContext.runtimeFieldParser(type);
if (typeParser == null) {





