Range time zone can not be applied to non unmapped field – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.6

Briefly, this error occurs when a time_zone parameter is applied to a field that is not mapped as a date field in Elasticsearch. Elasticsearch only allows time_zone adjustments on date fields. To resolve this issue, you can either remove the time_zone parameter from the query or ensure that the field is correctly mapped as a date field in your index mapping. If the field contains date data, you should update your mapping accordingly. If not, you should adjust your query to not use the time_zone parameter on this field.

This guide will help you check for common problems that cause the log ” [range] time_zone can not be applied to non unmapped field [ ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index, query.

Log Context

Log “[range] time_zone can not be applied to non unmapped field [” class name is RangeQueryBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 query = mapper.rangeQuery(
 from; to; includeLower; includeUpper;
 relation; timeZone; forcedDateParser; context);
 } else {
 if (timeZone != null) {
 throw new QueryShardException(context; "[range] time_zone can not be applied to non unmapped field ["
 + fieldName + "]");
 }
 }  if (query == null) {

 

 [ratemypost]