使用边界框 GeoLocation 的弹性搜索渗透在 Lucene 中抛出 NullPointerException

Elastic Search Percolation with Bounding Box GeoLocation throws NullPointerException in Lucene

我在从 Elastic Search 2.1.0 迁移到 2.2.0 时遇到的有趣问题。

我们目前使用的是ES的percolate特性,部分查询涉及bounding box查询。

索引映射片段:

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

然后,比如说,我们有一个使用地理边界框进行过滤的查询:

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

调用渗滤 API 后,它 returns 做出以下响应:

{
  "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": []
}

到文档位置:

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

但是它不会一直发生,例如如果我将坐标更改为不同的东西,它会 returns 结果。有些坐标会抛出它,有些则不会。任何想法为什么?

弹性搜索服务器堆栈跟踪是这样的:

Caused by: java.lang.NullPointerException
        at org.apache.lucene.search.GeoPointTermQueryConstantScoreWrapper.getDocIDs(GeoPointTermQueryConstantScoreWrapper.java:86)
        at org.apache.lucene.search.GeoPointTermQueryConstantScoreWrapper.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.access0(PercolatorService.java:108)
        at org.elasticsearch.percolator.PercolatorService.doPercolate(PercolatorService.java:609)
        ... 10 more

知道为什么某些 latlong 会发生这种情况的任何想法都很好。谢谢!

我遇到了类似的问题,我认为这是 Elasticsearch 2.2.0 中的一个错误,因为所有的工作都是用 geo 完成的,详细信息在这里 Supercharging geo_point fields in Elasticsearch 2.2

我已经在 Github 上提交了一份错误报告 link 到你在 Github Issue #16832 的帖子以及我自己的问题示例。