Elastic Search Percolation with Bounding Box GeoLocation throws NullPointerException in Lucene


(GVF) #1

Interesting problem I'm encountering when we moved from Elastic Search 2.1.0 to 2.2.0.

We're using ES's percolate feature currently, and part of the query involves bounding box query.

Index Mapping snippet:

{
  "mappings": {
    "person": {
       "properties": {
       ...
         "location": {
            "type": "geo_point"
         },
       ...
    }
  }
}

Then, say, we have a query that filters with geo bounding box:

... query... 
{
  "geo_bounding_box": {
    "location": {
      "top_left": [151.197033, -33.85610899999999],
      "bottom_right": [151.22295099999994, -33.879704]
    }
  }
}

Upon calling the percolation API, it returns the following response:

{
  "took": 18,
  "_shards": {
    "total": 5,
    "successful": 4,
    "failed": 1,
    "failures": [
      {
        "shard": 1,
        "index": "indexname_20160217",
        "status": "INTERNAL_SERVER_ERROR",
        "reason": {
          "type": "null_pointer_exception",
          "reason": null
        }
      }
    ]
  },
  "total": 0,
  "matches": []
}

To a doc with location:

"location": {
  "lat": -33.86747690000000,
  "lon": 151.20697759999996
}

but it doesn't happen all the time, e.g. if I change
the coordinates to something different, it returns a result. Some
coordinates would throw it, some doesn't. Any ideas why?

The elastic search server stack trace is this:

Caused by: java.lang.NullPointerException
        at org.apache.lucene.search.GeoPointTermQueryConstantScoreWrapper$1.getDocIDs(GeoPointTermQueryConstantScoreWrapper.java:86)
        at org.apache.lucene.search.GeoPointTermQueryConstantScoreWrapper$1.scorer(GeoPointTermQueryConstantScoreWrapper.java:126)
        at org.apache.lucene.search.BooleanWeight.scorer(BooleanWeight.java:280)
        at org.apache.lucene.search.BooleanWeight.scorer(BooleanWeight.java:280)
        at org.apache.lucene.search.BooleanWeight.scorer(BooleanWeight.java:280)
        at org.elasticsearch.common.lucene.Lucene.exists(Lucene.java:248)
        at org.elasticsearch.percolator.QueryCollector$Match.collect(QueryCollector.java:184)
        at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:218)
        at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:169)
        at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39)
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:821)
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:535)
        at org.elasticsearch.percolator.PercolatorService.queryBasedPercolating(PercolatorService.java:816)
        at org.elasticsearch.percolator.PercolatorService.access$400(PercolatorService.java:108)
        at org.elasticsearch.percolator.PercolatorService$5.doPercolate(PercolatorService.java:609)
        ... 10 more

Any ideas why this happens to some latlongs would be great. THANKS!


(system) #2