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

版本: 6.8-7.12

简而言之,当定义 Elasticsearch 索引模板时未指定必需字段(match、path_match 或 match_mapping_type)时,会出现此错误。这些字段对于确定模板应该应用于哪些字段是必需的。要解决此问题,你应该检查你的模板并确保至少设置了这些字段中的一个。例如,你可以使用 “match”: “*” 将模板应用于所有字段,或者通过 “match”: “field_name” 或 “match_mapping_type”: “type” 指定特定的字段或类型。

日志上下文 #

日志 “template must have match; path_match or match_mapping_type set” 的类名是 DynamicTemplate.java. 我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入背景的人提供参考:

throw new IllegalArgumentException("Illegal dynamic template parameter: [" + propName + "]");
 }
 }  if (match == null && pathMatch == null && matchMappingType == null) {
 throw new MapperParsingException("template must have match; path_match or match_mapping_type set " + conf.toString());
 }
 if (mapping == null) {
 throw new MapperParsingException("template [" + name + "] must have either mapping or runtime set");
 }