{
"script_fields": {
"distance": {
"script": {
"inline": "doc['location'].distanceInKm(12.898365,77.594359)"
}
}
}
}
mappings
"location": {
"type": "geo_point"
}
got the following error as unable to find dynamic method distanceInKm
"reason": {
"type": "script_exception",
"reason": "runtime error",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Unable to find dynamic method [distanceInKm] with [2] arguments for class [org.elasticsearch.index.fielddata.ScriptDocValues.GeoPoints]."
},
"script_stack": ["doc['location'].distanceInKm(12.898365,77.594359)", " ^---- HERE"],
"script": "doc['location'].distanceInKm(12.898365,77.594359)",
"lang": "painless"
}
tried reading all the docs unable to resolve this. hope the folks here will help me solve this.
I was abe to find distance using sort functionality but distanceInKM is not working!
is it a bug or my query is wrong ?