【发布时间】:2014-02-25 08:57:58
【问题描述】:
我有以下弹性搜索查询:
{
"from": 0,
"size": 10,
"fields": ["returnresults"],
"script_fields": {
"distance": {
"params": {
"lat": -41.166670,
"lon": 146.350000
},
"script": "doc[\u0027location\u0027].distanceInKm(lat,lon)"
}
},
"track_scores": true,
"sort": [{
"_geo_distance": {
"searchindex.location": [146.350000,
-41.166670],
"order": "asc",
"unit": "km"
},
"_score": {
"order": "desc"
}
}],
"query": {
"query_string": {
"query": "7383492",
"fields": ["total"]
}
},
"filter": {
"and": [{
"query": {
"range": {
"expiry": {
"gt": 1393285386
}
}
}
},
]
}
}
当我运行查询时,它找到了一些匹配的结果,但是它报告的距离是错误的。
海外地理编码 coord:37.445796966553,-122.16209411621
它返回的结果是距离 31145 公里。这是不可能的。
我在查询中做错了什么,或者这是弹性搜索本身的问题。我似乎对短距离没有问题,但这可能是它关闭的百分比只是很小的,因为它是短距离。
我目前使用的是 Elasticsearch 0.90.2
任何帮助将不胜感激。
【问题讨论】:
标签: elasticsearch