【发布时间】:2020-09-09 19:46:31
【问题描述】:
我正在对 geo_distance 过滤器使用弹性搜索,所以问题是它的距离测量与以下查询完全不同,我正在过滤 2500 米,但它返回给我一个 6500 米的地方,为什么会这样?我在谷歌地图上交叉验证点之间的距离。
查询
"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
【问题讨论】:
标签: elasticsearch