根据给定距离过滤位置

时间:2018-08-03 08:31:47

标签: elasticsearch

我从弹性搜索中以以下格式获取了数千个数据。

_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 488812,
    "max_score": 1.0,
    "hits": [
      {
        "_index": "pdev",
        "_type": "pod",
        "_id": "371931",
        "_score": 1.0,
        "_source": {
          "gid": 371931,
          "amphoe_e": "Pom Prap Sattru Phai",
          "str_name_e": "Chaloem Khet 1",
          "geom": {
            "type": "geometry",
            "value": "0101000020E61000000EBF9B6ED9205940DE1D19ABCD7F2B40"
          },
          "type": 158,
          "bootless": 0,
          "name_e": "ST Auto Parts Ltd., Part.",
          "province_e": "Bangkok",
          "@version": "1",
          "tambon_e": "Wat Thep Sirin",
          "pod_id": 139385,
          "new_type": "1002",
          "@timestamp": "2018-07-18T03:49:16.746Z",
          "location": "13.749616,100.513271",
        }
      },

我正在尝试根据geo_distance生成结果,geo_distance是位于距用户输入经纬度lat和long一定距离处的结果。我正在使用以下查询功能

{
    "query": {
        "bool" : {
            "must" : {
                "match_all" : {}
            },
            "filter" : {
                "geo_distance" : {
                    "distance" : "200km",
                    "location": 13.749616,100.513271
                }
            }
        }
    }
}

但是我不确定应该更改什么以获得结果。

0 个答案:

没有答案