【问题标题】:Elastic Search Percolation with Bounding Box GeoLocation throws NullPointerException in Lucene具有边界框 GeoLocation 的弹性搜索渗透在 Lucene 中引发 NullPointerException
【发布时间】:2016-03-01 21:18:47
【问题描述】:

当我们从 Elastic Search 2.1.0 迁移到 2.2.0 时,我遇到了一个有趣的问题。

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

索引映射 sn-p:

{
  "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后,返回如下响应:

{
  "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
}

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

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

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

任何想法为什么会发生在某些经纬度上都会很棒。谢谢!

【问题讨论】:

    标签: elasticsearch lucene geolocation bounding-box


    【解决方案1】:

    我遇到了类似的问题,我认为这是 Elasticsearch 2.2.0 中的一个错误,因为所有的工作都与地理有关,详情请点击此处Supercharging geo_point fields in Elasticsearch 2.2

    我已在 Github 上提交了一份错误报告,其中包含指向您在 Github Issue #16832 上的帖子的链接以及我自己的问题示例。

    【讨论】:

    • 谢谢。当我试图搜索是否有这方面的最新消息时,我也在 github 上看到了你的帖子。希望他们能尽快解决这个问题。
    • Elastic 人员提供了一种解决方法 - 所有详细信息都在票证链接中 (github.com/elastic/elasticsearch/issues/16832)
    猜你喜欢
    • 2019-11-13
    • 1970-01-01
    • 1970-01-01
    • 2014-02-27
    • 2017-08-27
    • 1970-01-01
    • 1970-01-01
    • 2016-03-28
    • 1970-01-01
    相关资源
    最近更新 更多