# Geodistance sort throws Elasticsearch exception \[type=parsing\_exception, reason=\[\_geo\_distance\] does not support \[ignore\_unmapped\]\] Elastic search version 6.3.0

**URL:** <https://discuss.elastic.co/t/geodistance-sort-throws-elasticsearch-exception-type-parsing-exception-reason-geo-distance-does-not-support-ignore-unmapped-elastic-search-version-6-3-0/222930>\
**Category:** Elasticsearch\
**Created:** [March 10, 2020, 12:38pm UTC](https://discuss.elastic.co/t/geodistance-sort-throws-elasticsearch-exception-type-parsing-exception-reason-geo-distance-does-not-support-ignore-unmapped-elastic-search-version-6-3-0/222930 "2020-03-10T12:38:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsunish](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsunish/32/39861_2.png) [@jsunish](https://discuss.elastic.co/u/jsunish)\
**Post date:** [March 10, 2020, 12:38pm UTC](https://discuss.elastic.co/t/geodistance-sort-throws-elasticsearch-exception-type-parsing-exception-reason-geo-distance-does-not-support-ignore-unmapped-elastic-search-version-6-3-0/222930/1 "2020-03-10T12:38:31Z")

</div>

I am searching the index object based on the lat long (geo\_point type) for a distance of 999km and I am sorting it on the ascending order.  
But I am getting the exception Elasticsearch exception [type=parsing\_exception, reason=[\_geo\_distance] does not support [ignore\_unmapped]]  
I am using elasticsearch version 6.3.0 alothough the same code is working fine in version 6.4.0. Is there anyway I can make it work in version 6.3.0

Here is the code that is searching and sorting.

```
	QueryBuilder queryBuilder = boolQuery().filter(
				QueryBuilders
				.geoDistanceQuery(LOCATION)
				.point(Double.parseDouble(latitude),Double.parseDouble(longitude))
				.distance(Double.parseDouble(range), DistanceUnit.KILOMETERS)
			);
	GeoDistanceSortBuilder sortBuilderAsc = SortBuilders.geoDistanceSort("location", new Double(latitude), new Double(longitude))
			.order(SortOrder.ASC)
			.unit(DistanceUnit.KILOMETERS)
			.sortMode(SortMode.MIN);
	SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
	searchSourceBuilder.query(queryBuilder).sort(sortBuilderAsc);
	SearchRequest searchRequest = new SearchRequest(index);
	searchRequest.source(searchSourceBuilder);
	searchRequest.searchType(SearchType.DFS_QUERY_THEN_FETCH);
	SearchResponse response = getClient().search(searchRequest, RequestOptions.DEFAULT);

```

This is the index mapping

```
{
  "buildings": {
    "mappings": {
      "esbuilding": {
        "properties": {
          "addressStreet1": {
            "type": "text"
          },
          "addressStreet2": {
            "type": "text"
          },
          "buildingName": {
            "type": "text"
          },
          "city": {
            "type": "text"
          },
          "location": {
            "type": "geo_point"
          },
          "state": {
            "type": "text"
          }
        }
      }
    }
  }
}

```

Here is the search JSON that is generated from the above Java Code for a given lat long.

```
{
  "sort" : [
        {
            "_geo_distance" : {
      					"location": [
      						-71.588822,
      						42.333777
      					],
                "order" : "asc",
                "unit" : "km",
                "mode" : "min",
                "distance_type" : "arc",
                "ignore_unmapped": true
            }
        }
    ],
	"query": {
		"bool": {
			"filter": [{
				"geo_distance": {
					"location": [
						-71.588822,
						42.333777
					],
					"distance" : 999000.0,
					"distance_type": "arc",
					"validation_method": "STRICT",
					"ignore_unmapped": false,
					"boost": 1.0
				}
			}],
			"adjust_pure_negative": true,
			"boost": 1.0
		}
	}
}

```

Stack trace:

```
org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=parsing_exception, reason=[_geo_distance] does not support [ignore_unmapped]]
	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1406)
	at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1382)
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1269)
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1231)
	at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:730)
	at com.trimble.engage.search.repository.ElasticSearchRepository.searchByQueryAndSort(ElasticSearchRepository.java:64)

```

Is there anyway I can remove the field "ignore\_unmapped" from the above java code. If I remove the field ignore\_unmapped, it is working fine in version 6.3.0

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 10, 2020, 12:57pm UTC](https://discuss.elastic.co/t/geodistance-sort-throws-elasticsearch-exception-type-parsing-exception-reason-geo-distance-does-not-support-ignore-unmapped-elastic-search-version-6-3-0/222930/2 "2020-03-10T12:57:42Z")

</div>

Which client version are you using?  
You should may be use the same 6.3 version of the client?

But, I'd recommend upgrading everything to at least 6.8.7.

---

<div class="post-metadata">

**Author:** ![jsunish](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsunish/32/39861_2.png) [@jsunish](https://discuss.elastic.co/u/jsunish)\
**Post date:** [March 10, 2020, 1:20pm UTC](https://discuss.elastic.co/t/geodistance-sort-throws-elasticsearch-exception-type-parsing-exception-reason-geo-distance-does-not-support-ignore-unmapped-elastic-search-version-6-3-0/222930/3 "2020-03-10T13:20:01Z")

</div>

I have tried different client versions  
6.3.0  
6.4.0  
7.0.0  
But all of them giving the same exception.  
Are you suggesting to upgrade the elasticsearch to version 6.8.7 or just the libraries?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 10, 2020, 2:14pm UTC](https://discuss.elastic.co/t/geodistance-sort-throws-elasticsearch-exception-type-parsing-exception-reason-geo-distance-does-not-support-ignore-unmapped-elastic-search-version-6-3-0/222930/4 "2020-03-10T14:14:38Z")

</div>

How did you define the version to use?  
Did you check the dependency tree to make sure that versions are exactly what you think they are?

> [@jsunish](#):
>
> Are you suggesting to upgrade the elasticsearch to version 6.8.7 or just the libraries?

Both

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 7, 2020, 2:14pm UTC](https://discuss.elastic.co/t/geodistance-sort-throws-elasticsearch-exception-type-parsing-exception-reason-geo-distance-does-not-support-ignore-unmapped-elastic-search-version-6-3-0/222930/5 "2020-04-07T14:14:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
