I need to compute an arc distance inside a Painless script, but have not found a way of accessing the geo APIs in this case, i.e:
- the first point is passed to the script as a param - which means I only get primitive values
- the second point is read from a nested document - which means I can't read the field using the
doc[myGeoField].value
API
In both cases, I am unable to instantiate a org.elasticsearch.index.fielddata.ScriptDocValues.GeoPoints
which would give me access to the .arcDistance()
method.
I am also unable to use the org.elasticsearch.common.geo.GeoUtils
class which is not whitelisted in Painless.
Is there any other option for computing an arc-distance in a script ?
Note: for reasons that would be too long to explain here, I have to use a script for this use case - doing it in a query / filter is not an option.