版本: 7.11-7.15
简而言之,当您尝试在 Elasticsearch 的同一动态模板中同时定义映射和运行时字段时,会出现此错误。Elasticsearch 不允许这样做,因为它可能导致冲突。要解决此问题,您可以从动态模板中删除运行时字段,或者将其与映射分开定义。或者,您可以为运行时字段创建一个单独的动态模板。这将确保映射和运行时字段之间不存在冲突。
日志上下文 #
日志 “mapping and runtime cannot be both specified in the same dynamic template [” 的类名是 DynamicTemplate.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
matchMappingType = entry.getValue().toString();
} else if ("match_pattern".equals(propName)) {
matchPattern = entry.getValue().toString();
} else if ("mapping".equals(propName)) {
if (mapping != null) {
throw new MapperParsingException("mapping and runtime cannot be both specified in the same dynamic template ["
+ name + "]");
}
mapping = (Map) entry.getValue();
runtime = false;
} else if ("runtime".equals(propName)) {





