# Geo\_distance does not work with Percolator ES 2.3.1

**URL:** <https://discuss.elastic.co/t/geo-distance-does-not-work-with-percolator-es-2-3-1/48770>\
**Category:** Elasticsearch\
**Created:** [April 29, 2016, 6:53am UTC](https://discuss.elastic.co/t/geo-distance-does-not-work-with-percolator-es-2-3-1/48770 "2016-04-29T06:53:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xamien](https://avatars.discourse-cdn.com/v4/letter/x/74df32/32.png) [@xamien](https://discuss.elastic.co/u/xamien)\
**Post date:** [April 29, 2016, 6:53am UTC](https://discuss.elastic.co/t/geo-distance-does-not-work-with-percolator-es-2-3-1/48770/1 "2016-04-29T06:53:16Z")

</div>

Hello,  
does anyone know where is the problem?

**Create index with mapping:**

```
PUT new-index
{
  "mappings": {
	"type": {
	  "properties": {
		"location": {
		  "type": "geo_point",
		  "fielddata": {
			"lat_lon": "true"
		  }
		}
	    }
	}
    }
}

```

**Create new Percolator request:**

```
PUT new-index/.percolator/1
{
	"query": {
		"filtered": {
			"filter": {
			   "geo_distance": {
				  "distance": "500m",
				  "location": {
					 "lat": 14.4300162050001,
					 "lon": 50.0755601170001
				  }
			   }
		   }
		}
	}
}

```

**Query Percolator:**

```
GET new-index/type/_percolate
{
	"doc": {
		"location": {
			"lat": 14.4271622,
			"lon": 50.0749853
		}
	}
}

```

**Result:**

```
{
   "took": 50,
   "_shards": {
	  "total": 8,
	  "successful": 7,
	  "failed": 1,
	  "failures": [
		 {
			"shard": 3,
			"index": "new-index",
			"status": "INTERNAL_SERVER_ERROR",
			"reason": {
			   "type": "null_pointer_exception",
			   "reason": null
			}
		 }
	  ]
   },
   "total": 0,
   "matches": []
}

[2016-04-29 06:47:03,953][DEBUG][action.percolate] [primary-mndn0] [new-index][3], node[0Llr0DwEQc230HQtClCdmw], [R], v[3], s[STARTED], a[id=1ZEW7qedSqu1kI9T7N9QPw]: failed to execute [org.elasticsearch.action.percolate.PercolateRequest@5c4daf28]
RemoteTransportException[[backup-dn1][10.0.2.15:9321][indices:data/read/percolate[s]]]; nested: PercolateException[failed to percolate]; nested: PercolateException[failed to execute]; nested: NullPointerException;
Caused by: PercolateException[failed to percolate]; nested: PercolateException[failed to execute]; nested: NullPointerException;
		at org.elasticsearch.action.percolate.TransportPercolateAction.shardOperation(TransportPercolateAction.java:181)
		at org.elasticsearch.action.percolate.TransportPercolateAction.shardOperation(TransportPercolateAction.java:56)
		at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:282)
		at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:278)
		at org.elasticsearch.shield.transport.ShieldServerTransportService$ProfileSecuredRequestHandler.messageReceived(ShieldServerTransportService.java:180)
		at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75)
		at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.doRun(MessageChannelHandler.java:300)
		at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
		at java.lang.Thread.run(Thread.java:745)
Caused by: PercolateException[failed to execute]; nested: NullPointerException;
		at org.elasticsearch.percolator.PercolatorService$4.doPercolate(PercolatorService.java:583)
		at org.elasticsearch.percolator.PercolatorService.percolate(PercolatorService.java:254)
		at org.elasticsearch.action.percolate.TransportPercolateAction.shardOperation(TransportPercolateAction.java:178)
		... 10 more
Caused by: java.lang.NullPointerException
		at org.apache.lucene.spatial.geopoint.search.GeoPointTermQueryConstantScoreWrapper$1$1.matches(GeoPointTermQueryConstantScoreWrapper.java:132)
		at org.apache.lucene.search.TwoPhaseIterator$1.doNext(TwoPhaseIterator.java:66)
		at org.apache.lucene.search.TwoPhaseIterator$1.nextDoc(TwoPhaseIterator.java:54)
		at org.elasticsearch.common.lucene.Lucene.exists(Lucene.java:254)
		at org.elasticsearch.percolator.PercolatorService$4.doPercolate(PercolatorService.java:571)
		... 12 more

```

**ES version:**  
Version: 2.3.1, Build: bd98092/2016-04-04T12:25:05Z, JVM: 1.7.0\_95

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [April 29, 2016, 1:49pm UTC](https://discuss.elastic.co/t/geo-distance-does-not-work-with-percolator-es-2-3-1/48770/2 "2016-04-29T13:49:37Z")

</div>

Hi,

this is a known issue that has been fixed on the master branch:

> <https://github.com/elastic/elasticsearch/issues/16832>

For 2.3 there seems to be a workaround that worked when I tried it on your example. Take a look at [https://github.com/elastic/elasticsearch/issues/16832#issuecomment-197329289](https://github.com/elastic/elasticsearch/issues/16832#issuecomment-197329289), there is an example that shows how you can make ES believe the percolator index was created before v2.2.

---

<div class="post-metadata">

**Author:** ![xamien](https://avatars.discourse-cdn.com/v4/letter/x/74df32/32.png) [@xamien](https://discuss.elastic.co/u/xamien)\
**Post date:** [May 4, 2016, 10:32am UTC](https://discuss.elastic.co/t/geo-distance-does-not-work-with-percolator-es-2-3-1/48770/3 "2016-05-04T10:32:28Z")

</div>

Thank you Christoph, it works as you described.

---

<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:** [July 5, 2017, 10:54pm UTC](https://discuss.elastic.co/t/geo-distance-does-not-work-with-percolator-es-2-3-1/48770/4 "2017-07-05T22:54:05Z")

</div>


