# Geo Distance filter with multiple lat/lon

**URL:** <https://discuss.elastic.co/t/geo-distance-filter-with-multiple-lat-lon/39955>\
**Category:** Elasticsearch\
**Created:** [January 23, 2016, 8:01pm UTC](https://discuss.elastic.co/t/geo-distance-filter-with-multiple-lat-lon/39955 "2016-01-23T20:01:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deep\_2](https://avatars.discourse-cdn.com/v4/letter/d/7feea3/32.png) [@Deep\_2](https://discuss.elastic.co/u/Deep_2)\
**Post date:** [January 23, 2016, 8:01pm UTC](https://discuss.elastic.co/t/geo-distance-filter-with-multiple-lat-lon/39955/1 "2016-01-23T20:01:54Z")

</div>

Hi,

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.

Regards,  
Deep

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 24, 2016, 6:33pm UTC](https://discuss.elastic.co/t/geo-distance-filter-with-multiple-lat-lon/39955/2 "2016-01-24T18:33:46Z")

</div>

What does your data and mappings look like?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:22pm UTC](https://discuss.elastic.co/t/geo-distance-filter-with-multiple-lat-lon/39955/3 "2017-07-05T23:22:04Z")

</div>


