Referenced field must be mapped to geo point – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.1

Briefly, this error occurs when Elasticsearch tries to perform a geo-based operation on a field that is not mapped as a geo_point. Elasticsearch requires fields used for geographical operations to be mapped as geo_point. To resolve this issue, you can either reindex your data with the correct mapping or use the “PUT mapping” API to update the mapping of the field to geo_point. However, remember that updating the mapping will only affect new data and not the existing ones.

This guide will help you check for common problems that cause the log ” referenced field must be mapped to geo_point ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: search.

Log Context

Log “referenced field must be mapped to geo_point” class name is GeoContextMapping.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 @Override
 public Set parseContext(ParseContext parseContext; XContentParser parser) throws IOException; ElasticsearchParseException {
 if (fieldName != null) {
 MappedFieldType fieldType = parseContext.mapperService().fieldType(fieldName);
 if (!(fieldType instanceof GeoPointFieldMapper.GeoPointFieldType)) {
 throw new ElasticsearchParseException("referenced field must be mapped to geo_point");
 }
 }
 final Set contexts = new HashSet<>();
 Token token = parser.currentToken();
 if (token == Token.START_ARRAY) {

 

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?