GeoPolygon Query: Illegal shift value, must be 32..63; got shift=0

Hi,

I'm having trouble executing a GeoPolygon query with a certain polygon and I'm unable to figure out what is wrong.
I have tried several other polygons with the same shape, which all execute correctly.
For some reason the coordinates that this polygon has, cause the IllegalArgumentException during the execution of the query.
I get the same result with Elasticsearch 2.4

steps to reproduce:

#curl -XPUT localhost:9200/test -d '{ "mappings" : { "type1" : { "properties" : { "location" : { "type" : "geo_point" }}}}}'
{"acknowledged":true}

 #curl -XPOST localhost:9200/test/type1 -d ' { "location": "52.2, 4.4" } '
{"_index":"test","_type":"type1","_id":"AVb-QdVXXlFHU-ps0fRw","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}

#curl localhost:9200/test/type1/_search -d '{ "query": { "geo_polygon" : { "location" : { "points": [ "-7.998047857222268, -71.00120202079853", "-7.999647520806379, -70.99417435493683", "-8.00600799977009, -70.99701389475712", "-7.998047857222268, -71.00120202079853"] } } } } '
{"took":60,"timed_out":false,"_shards":{"total":5,"successful":4,"failed":1,"failures":[{"shard":4,"index":"test","node":"IzpxgmG3T3S29dr-t01Y3Q","reason":{"type":"illegal_argument_exception","reason":"Illegal shift value, must be 32..63; got shift=0"}}]},"hits":{"total":0,"max_score":null,"hits":[]}}

My Elasticsearch version:

curl localhost:9200
{
  "name" : "Erik Killmonger",
  "cluster_name" : "testing",
  "version" : {
    "number" : "2.3.5",
    "build_hash" : "90f439ff60a3c0f497f91663701e64ccd01edbb4",
    "build_timestamp" : "2016-07-27T10:36:52Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  },
  "tagline" : "You Know, for Search"
}

my OS:

#uname -a
Linux test 2.6.32-504.8.1.el6.x86_64 #1 SMP Wed Jan 28 21:11:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

#cat /etc/redhat-release
CentOS release 6.6 (Final)

Output of logfile:

#cat testing.log
[INFO ][cluster.metadata         ] [Erik Killmonger] [test] creating index, cause [api], templates [], shards [5]/[1], mappings [type1]
[INFO ][cluster.routing.allocation] [Erik Killmonger] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[test][4]] ...]).
[DEBUG][action.search            ] [Erik Killmonger] [test][4], node[IzpxgmG3T3S29dr-t01Y3Q], [P], v[2], s[STARTED], a[id=Kej8nTfETrGblujkSIoc2w]: Failed to execute     [org.elasticsearch.action.search.SearchRequest@ccb0760]
RemoteTransportException[[Erik Killmonger][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: IllegalArgumentException[Illegal shift value, must be 32..63; got shift=0];
Caused by: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: IllegalArgumentException[Illegal shift value, must be 32..63; got shift=0];
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:409)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:113)
at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:366)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:378)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365)
at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75)
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Illegal shift value, must be 32..63; got shift=0
at org.apache.lucene.spatial.util.GeoEncodingUtils.geoCodedToPrefixCodedBytes(GeoEncodingUtils.java:114)
at org.apache.lucene.spatial.util.GeoEncodingUtils.geoCodedToPrefixCoded(GeoEncodingUtils.java:92)
at org.apache.lucene.spatial.geopoint.search.GeoPointPrefixTermsEnum$Range.fillBytesRef(GeoPointPrefixTermsEnum.java:234)
at org.apache.lucene.spatial.geopoint.search.GeoPointTermsEnum.nextRange(GeoPointTermsEnum.java:71)
at org.apache.lucene.spatial.geopoint.search.GeoPointPrefixTermsEnum.nextRange(GeoPointPrefixTermsEnum.java:169)
at org.apache.lucene.spatial.geopoint.search.GeoPointPrefixTermsEnum.nextSeekTerm(GeoPointPrefixTermsEnum.java:188)
at org.apache.lucene.index.FilteredTermsEnum.next(FilteredTermsEnum.java:212)
at org.apache.lucene.spatial.geopoint.search.GeoPointTermQueryConstantScoreWrapper$1.scorer(GeoPointTermQueryConstantScoreWrapper.java:103)
at org.apache.lucene.search.BooleanWeight.scorer(BooleanWeight.java:389)
at org.apache.lucene.search.Weight.bulkScorer(Weight.java:135)
at org.apache.lucene.search.BooleanWeight.bulkScorer(BooleanWeight.java:370)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:818)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:535)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:384)
... 12 more

@Hithran thanks for raising this. I've been able to reproduce this on 2.3.5 and 2.4.0 and it looks like a bug to me. I've raised an issue for this here: https://github.com/elastic/elasticsearch/issues/20333

This does not seem to be an issue int he upcoming 5.0 release.

@colings86 Thank you. I will monitor the issue