0

这是我的问题。我有一些数据存储在带有字段的索引中"location"。这是映射

{
    "data":{
        "properties":{
        ...
        "location":{
            "type": "geo_point",
            "lat_lon": true,
            "store": "yes"
        },
        ...
        }
    }
}

这是索引中存在的数据的示例

{
  "metadata": {
    "total": 2887,
    "maxScore": 4.8634477
  },
  "data": [
    {
      "_index": "data",
      "_type": "data",
      "_id": "8-HtWNILQrqrobwchhgNIQ",
      "_score": 4.8634477,
      "_source": {
        "generique": "Chemin",
        "_datasetId": "5175b2b4a652945a0500000d",
        "liaison": "",
        "specifique": "Sainte-Foy",
        "direction": "",
        "nomTopo": "Chemin Sainte-Foy",
        "ville": "Québec",
        "arrond": "Sainte-Foy-Sillery-Cap-Rouge",
        "location": {
          "lon": -71.322135,
          "lat": 46.768526
        }
      }
    },
    {
      "_index": "data",
      "_type": "data",
      "_id": "sSZ3u-uDQIuPDc2qnPir0g",
      "_score": 4.8634477,
      "_source": {
        "generique": "Chemin",
        "_datasetId": "5175b2b4a652945a0500000d",
        "liaison": "",
        "specifique": "Sainte-Foy",
        "direction": "",
        "nomTopo": "Chemin Sainte-Foy",
        "ville": "Québec",
        "arrond": "Sainte-Foy-Sillery-Cap-Rouge",
        "location": {
          "lon": -71.286977,
          "lat": 46.784508
        }
      }
    }
  ]
}

如果我想使用 geo_distance 执行请求,它会返回不相关的数据。

这是请求

{
  "query": {
    "filtered": {
      "query_string": {
        "query": "_datasetId:5175b2b4a652945a0500000d"
      },
      "filter": {
        "geo_distance": {
          "location": {
            "lat": 46.815569,
            "lon": -71.208401
          },
          "distance": "1km"
        }
      }
    }
  }
}

收到的数据不包含权利"_datasetId",也不包含"location"查询中给定的数据。

我希望我足够清楚谢谢。

4

1 回答 1

3

我实际上从邮件列表中得到了答案,我想分享它。

https://groups.google.com/forum/?fromgroups=#!topic/elasticsearch/cxZMZX-bWFA

于 2013-04-26T15:25:32.910 回答