Hi there!
I'm trying to loop over a geo_point array in my painless script, but I can't find a way to make it work.
My script is called in a script_score stage.
Here is the part of code not working :
for (def i=0; i < doc['locations'].values.length; i++) {
distance = Math.min(distance, doc['locations'].values[i].arcDistance(lat, lon) * 0.001);
}
And here's what I get :
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"distance = Math.min(distance, doc['locations'].values[i].arcDistance(lat, lon) * 0.001); }",
" ^---- HERE"
],
I also have this :
"reason": "Unable to find dynamic method [arcDistance] with [2] arguments for class [org.elasticsearch.common.geo.GeoPoint]."
I tried multiple things with my i
...
Do anyone of you see what I'm doing wrong?
Thank you!