Geo Distance filter with multiple lat/lon


My document has a geo_point field with array of lat/lon. The geoDistance filter does not seem to work with multiple lat/lon. It always considers the first lat/lon.

I want run a geo_distance filter with multiple lat/lon and sort results based on distance (nearest to furthest).

Right now I have written a groovy script that manually loops thru a array of lat/lon and calculates distance and returns a match if any lat/lon is within distance. But this approach does not seem to be correct.

Please guide.


What does your data and mappings look like?