我正在使用geo_distance过滤器来获取距引用点一定距离内的点。作为distance_unit,我设置了km,但是,当我运行代码时,我很确定Elastic会计算米,而不是公里(因此在下面的这种特殊情况下,我得到的点在20米而不是20公里之内) 。
有什么想法为什么要用米而不是公里?
{
"query": {
"filtered": {
"query": {
"bool": {
"must_not": [
{
"term": {
"_id": {
"value": idnum
}
}
}
]
}
},
"filter": {
"geo_distance": {
"distance": 20,
"distance_unit": "km",
"geopoint": {
"lat": lat,
"lon": lng
}
}
}
}
}
}
最佳答案
使用"distance": "20KM", rather than distance_unit....
关于elasticsearch - Elasticsearch geo_distance过滤器-距离单位设置为km,但似乎以米为单位进行计算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23080760/