I have the following elasticsearch query:
{
"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
}
}
}
},
]
}
}
When I run the query, it is finding some matching results, however the distance it is reporting is wrong.
For a geocode overseas at coord: 37.445796966553,-122.16209411621
It returns the result as been 31145km away. Which is not possible.
Am I doing something wrong in my query, or is this an issue inside elasticsearch itself. I don't seem to have an issue with short distances, but that could be the % it is off is only minor because of it being a short distance.
I am currently using Elasticsearch 0.90.2
Any help would be appreciated.