# Geo\_distance Filter with Multiple Locations

**URL:** <https://discuss.elastic.co/t/geo-distance-filter-with-multiple-locations/6198>\
**Category:** Elasticsearch\
**Created:** [December 20, 2011, 8:43pm UTC](https://discuss.elastic.co/t/geo-distance-filter-with-multiple-locations/6198 "2011-12-20T20:43:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_S\_Craig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_s_craig/32/3015_2.png) [@Mike\_S\_Craig](https://discuss.elastic.co/u/Mike_S_Craig)\
**Post date:** [December 20, 2011, 8:43pm UTC](https://discuss.elastic.co/t/geo-distance-filter-with-multiple-locations/6198/1 "2011-12-20T20:43:05Z")

</div>

So I'd like to be able to index this document:

{"name":"Starbucks",  
"locations":["40.741047,-74.001439", "40.6774,-75.146613"]}

And query it like this:

{"filter":{"geo\_distance":  
{"locations":"40.7405,-74.0068","distance":"1km"}}}

But I get QueryParsingExceptions that say "locations" is not a  
geo\_point field. Generically speaking, I want to index a document with  
an arbitrary number of locations and then do a geo\_distance filter  
over those locations. Can it be done?

Cheers,  
Mike

---

<div class="post-metadata">

**Author:** ![Mike\_S\_Craig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_s_craig/32/3015_2.png) [@Mike\_S\_Craig](https://discuss.elastic.co/u/Mike_S_Craig)\
**Post date:** [December 20, 2011, 8:48pm UTC](https://discuss.elastic.co/t/geo-distance-filter-with-multiple-locations/6198/2 "2011-12-20T20:48:23Z")

</div>

Answered my own question: I'd forgotten to set the field type as geo\_point.

Cheers,  
Mike

On Tue, Dec 20, 2011 at 3:43 PM, Mike S Craig [mkscrg@gmail.com](mailto:mkscrg@gmail.com) wrote:

> So I'd like to be able to index this document:
> 
> {"name":"Starbucks",  
> "locations":["40.741047,-74.001439", "40.6774,-75.146613"]}
> 
> And query it like this:
> 
> {"filter":{"geo\_distance":  
> {"locations":"40.7405,-74.0068","distance":"1km"}}}
> 
> But I get QueryParsingExceptions that say "locations" is not a  
> geo\_point field. Generically speaking, I want to index a document with  
> an arbitrary number of locations and then do a geo\_distance filter  
> over those locations. Can it be done?
> 
> Cheers,  
> Mike

---

<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 6, 2017, 3:44am UTC](https://discuss.elastic.co/t/geo-distance-filter-with-multiple-locations/6198/3 "2017-07-06T03:44:49Z")

</div>


