# Elastic Search Percolation with Bounding Box GeoLocation throws NullPointerException in Lucene

**URL:** <https://discuss.elastic.co/t/elastic-search-percolation-with-bounding-box-geolocation-throws-nullpointerexception-in-lucene/42079>\
**Category:** Elasticsearch\
**Created:** [February 17, 2016, 10:00pm UTC](https://discuss.elastic.co/t/elastic-search-percolation-with-bounding-box-geolocation-throws-nullpointerexception-in-lucene/42079 "2016-02-17T22:00:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gvf](https://avatars.discourse-cdn.com/v4/letter/g/f05b48/32.png) [@gvf](https://discuss.elastic.co/u/gvf)\
**Post date:** [February 17, 2016, 10:00pm UTC](https://discuss.elastic.co/t/elastic-search-percolation-with-bounding-box-geolocation-throws-nullpointerexception-in-lucene/42079/1 "2016-02-17T22:00:17Z")

</div>

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!

---

<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, 11:15pm UTC](https://discuss.elastic.co/t/elastic-search-percolation-with-bounding-box-geolocation-throws-nullpointerexception-in-lucene/42079/2 "2017-07-05T23:15:33Z")

</div>


