Template name must have either mapping or runtime set – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.11-8.9

Briefly, this error occurs when an Elasticsearch index template is created without specifying either a mapping or a runtime. Index templates in Elasticsearch require at least one of these to define how the fields in the index should be stored and searched. To resolve this issue, you can either add a mapping or a runtime to your index template. A mapping defines the data types for the fields, while a runtime allows you to define fields which will be calculated at query time.

This guide will help you check for common problems that cause the log ” template [” + name + “] must have either mapping or runtime set ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: mapping, template, index.

Log Context

Log “template [” + name + “] must have either mapping or runtime set” class name is DynamicTemplate.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 // so we need to ignore them at parsing time for old indices
 throw new IllegalArgumentException("Illegal dynamic template parameter: [" + propName + "]");
 }
 }
 if (mapping == null) {
 throw new MapperParsingException("template [" + name + "] must have either mapping or runtime set");
 }  final XContentFieldType[] xContentFieldTypes;
 if ("*".equals(matchMappingType) || (matchMappingType == null && matchPatternsAreDefined(match; pathMatch))) {
 if (runtime) {

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?