我正在使用elasticsearch搜索地理距离过滤器,所以问题是它的距离测量是非常像在下面的查询中,我过滤2500米,但它返回我一个地方,这是6500米为什么会这样?我在谷歌Map上交叉验证了点之间的距离。
查询
"query": {
"nested": {
"path": "sellers",
"query": {
"bool": {
"must": [
{
"match": {
"sellers.active": true
}
}
],
"filter": {
"geo_distance": {
"distance": "226",
"distance_type":"arc",
"sellers.seller_geo": [ 31.0035008, 75.8480896]
}
}
}
},
"inner_hits" : {
"sort": [
{
"sellers.sale_price": "asc"
}
],
"size":1,
"name": "hits_1"
}
}
}
}
结果是
"took" : 47,
"hits" : {
"hits" : [
{
"inner_hits" : {
"hits_1" : {
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
{
"_index" : "shopping_items",
"_type" : "_doc",
"_id" : "Z0AP8VFAEO",
"_nested" : {
"field" : "sellers",
"offset" : 22
},
"_score" : null,
"_source" : {
"prime" : true,
"instant_delivery" : true,
"dispatch_days" : 0,
"active" : true,
"cod" : false,
"discount" : "21.43",
"list_price" : 1964.25,
"seller_geo" : [
30.998450,
75.848835
],
"postal_code" : 141001,
"sale_price" : 1964.25,
"seller_id" : "A07RE66FZA"
},
"sort" : [
1964.25
]
}
]
}
}
}
}
]
}
}````
30.998450,75.848835和31.0035008,75.8480896之间的距离为9.34km
1条答案
按热度按时间xeufq47z1#
[30.998450, 75.848835]
订单在哪里lat, lon
是印度旁遮普的一个点。从另一个Angular 看,它意味着巴伦支海靠近北极圈的一个点。。。现在
geo_distance
查询,就像geo_point
数据类型解析位置,如lon, lat
,从而符合geojson标准。换言之,您的地理点未正确索引。您可以通过删除索引和反转坐标来修复它。我个人喜欢用下面的符号来代替
这样人们就不会困惑了。