我正在使用ElasticSearch 1.1.0,并尝试使用地理距离过滤器。
这是我的映射
{
"dynamic": "true",
"numeric_detection": true,
"properties": {
"address": {
"type": "nested",
"properties": {
"city": {
"type": "string"
},
"country": {
"type": "string"
},
"location": {
"type": "geo_point"
},
"postcode": {
"type": "integer"
},
"region": {
"type": "string"
},
"state": {
"type": "string"
}
}
}
}
}
这是我的文件
"address": {
"postcode": "29004",
"city": "Málaga",
"state": "Málaga",
"region": "Málaga",
"country": "espagne",
"location": {
"lat": 36.68676,
"lon": -4.49028
}
}
(映射是在索引任何文档之前创建的,并且文档已被很好地编入索引)。但是当尝试使用以下查询字符串
获取此annonce时{
"query": {
"filtered": {
"query": {
"match_all": {
}
},
"filter": {
"geo_distance": {
"distance": "200km",
"address.location": {
"lat": 36.68676,
"lon": -4.49028
}
}
}
}
}
}
我没有结果......我无法理解为什么。难道我做错了什么 ?谢谢你的帮助:)!
答案 0 :(得分:1)