elasticsearch ElasticSearch使用lat/long查找文档精确匹配,elasticsearch,kibana,elasticsearch,Kibana" /> elasticsearch ElasticSearch使用lat/long查找文档精确匹配,elasticsearch,kibana,elasticsearch,Kibana" />

elasticsearch ElasticSearch使用lat/long查找文档精确匹配

elasticsearch ElasticSearch使用lat/long查找文档精确匹配,elasticsearch,kibana,elasticsearch,Kibana,我的索引中有此字段映射: "businessLocation": { "type": "geo_point" }, 我想找到与我的lat/long坐标完全匹配的文档。我尝试了geo_distance但是,要求我的距离大于0 我甚至试过这个问题: { "query": { "bool": { "must": [ { "query_string": { "default

我的索引中有此字段映射:

 "businessLocation": {
            "type": "geo_point"
          },
我想找到与我的
lat/long
坐标完全匹配的文档。我尝试了
geo_distance
但是,要求我的距离大于0

我甚至试过这个问题:

{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "default_field": "businessLocation",
            "query": "src.lat = 34.47  AND src.lon = -122.37"
          }
        }
      ]
    }
  }
}
然而,我得到了这个错误:

Geo fields do not support exact searching, use dedicated geo queries instead: [businessLocation]

您需要以不同的方式查询地理字段。这是错误的状态。有关更多信息,请参阅

如果你需要接近你的标准,考虑降低距离查询的距离参数,但请记住。

{
    "query": {
        "bool" : {
            "must" : {
                "match_all" : {}
            },
            "filter" : {
                "geo_distance" : {
                    "distance" : "2km",
                    "businessLocation" : {
                        "lat" : 34.47,
                        "lon" : -122.37
                    }
                }
            }
        }
    }
}

+1答案是正确的,但更重要的是精确的点匹配,您可以将距离一直降低到1毫米(
“距离”:“1mm”
),这基本上是一个精确匹配。感谢您的+1:D您的选择是正确的,但在我看来,这种低距离只能以高分辨率匹配具有lat/lon的文档(小数位数)。