2013-04-22 47 views
0

这是我的问题。我有一些数据存储在索引字段"location"。 这里的映射无法使用geo_distance进行过滤查询。 Elasticsearch

{ 
    "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"接近从查询中给出的一个。

我希望我很清楚 谢谢。

回答

相关问题