1
我使用Elasticsearch索引我的网站上的一些物品和我不断收到可笑夸张的距离。即使我使用相同的坐标进行搜索,我仍然可以获得3000公里的距离。
发表:
[{
"expiryDate": "2014-04-11 02:32:16",
"geo": {
"lon": 45.297,
"lat": 75.0755
},
"id": "5571afb7ae2c287f4d54b713",
"images": [],
"imagesLinks": [],
}]
映射:
{
"listingsell" : {
"properties" : {
"geo" : {
"type" : "geo_point",
"fielddata" : {
"format" : "compressed",
"precision" : "1m"
}
}
}
}
}
查询:
{
"query": {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"geo_distance" : {
"distance" : "90000mi",
"geo" : {
"lat" : 45.1339,
"lon" : 75.019
}
}
}
}
},
"sort" : [
{
"_geo_distance" : {
"geo" : {
"lat" : 45.1339,
"lon" : 75.019
},
"order" : "asc",
"unit" : "mi"
}
}
],
}
结果:
{
"sort":[2247.4929]
}