Geo_distance does not work with Percolator ES 2.3.1

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

Hi,

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

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, there is an example that shows how you can make ES believe the percolator index was created before v2.2.

Thank you Christoph, it works as you described.