# Geo distance filter exceptions

**URL:** <https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960>\
**Category:** Elasticsearch\
**Created:** [July 29, 2014, 8:30pm UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960 "2014-07-29T20:30:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madhavan\_Ramachandra](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Madhavan\_Ramachandra](https://discuss.elastic.co/u/Madhavan_Ramachandra)\
**Post date:** [July 29, 2014, 8:30pm UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960/1 "2014-07-29T20:30:12Z")

</div>

Hi Team,

I am trying to find a solution for the below

1. Geo boundary based search.. My index have property for lat and lon as  
double.. not as a geopoint.. Here is my mapping for my index..

How do i use the lon and lat from the below mapping for geo distance  
filter/geo distance range filter ?

Name Type Format Store?  
data string

getpath string

id double

Region string

Submarket string

addr1 string

addr2 string

city string

citymarket string

country string

countryid long

cultureid long

data string

details string

fax string

id string

language string

lat double

lon double

When I search for the documents.. i got the below exception..

Query :  
{  
"filter": {  
"geo\_distance" : {  
"distance" : "300km",  
"location" : {  
"lat" : 45,  
"lon" : -122  
}  
}

}  
}

Exception:  
"error": "SearchPhaseExecutionException[Failed to execute phase [query],  
all shards failed; shardFailures  
{[o3f66HetT3OSpVw895w0nA][offlocations][4]:  
SearchParseException[[offlocations][4]: from[-1],size[-1]: Parse Failure  
[Failed to parse source [{\n"filter": {\n "geo\_distance" : {\n  
"distance" : "300km",\n "location" : {\n "lat" : 45,\n "lon" :  
-122\n }\n } \n }\n}]]]; nested:

I tried with removing the location, which i dont have in my mapping..

{"filter": { "geo\_distance" : { "distance" : "300km", "lat"  
: 45, "lon" : -122 } }}

I got the exception as lon is not a geo\_point field..

ElasticsearchIllegalArgumentException[the character '-' is not a valid  
geohash character]; }]"

If i remove the "-" infront of lon.. then the exception says :

QueryParsingException[[offlocations] field [lon] is not a geo\_point field];

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 29, 2014, 8:34pm UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960/2 "2014-07-29T20:34:53Z")

</div>

No you can't out of the box. If you want to use built in geo filters you need geo points.

That said, you can use scripts to do it based on lat,lon fields but it will be slower.

My 2 cents

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 29 juil. 2014 à 22:30, Madhavan Ramachandran [madhavtr@gmail.com](mailto:madhavtr@gmail.com) a écrit :

Hi Team,

I am trying to find a solution for the below

Geo boundary based search.. My index have property for lat and lon as double.. not as a geopoint.. Here is my mapping for my index..  
How do i use the lon and lat from the below mapping for geo distance filter/geo distance range filter ?

Name Type Format Store?  
data string

getpath string

id double

Region string

Submarket string

addr1 string

addr2 string

city string

citymarket string

country string

countryid long

cultureid long

data string

details string

fax string

id string

language string

lat double

lon double

When I search for the documents.. i got the below exception..

Query :  
{  
"filter": {  
"geo\_distance" : {  
"distance" : "300km",  
"location" : {  
"lat" : 45,  
"lon" : -122  
}  
}

}  
}

Exception:  
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[o3f66HetT3OSpVw895w0nA][offlocations][4]: SearchParseException[[offlocations][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n"filter": {\n "geo\_distance" : {\n "distance" : "300km",\n "location" : {\n "lat" : 45,\n "lon" : -122\n }\n } \n }\n}]]]; nested:  
I tried with removing the location, which i dont have in my mapping..  
{"filter": { "geo\_distance" : { "distance" : "300km", "lat" : 45, "lon" : -122 } }}  
I got the exception as lon is not a geo\_point field..  
ElasticsearchIllegalArgumentException[the character '-' is not a valid geohash character]; }]"  
If i remove the "-" infront of lon.. then the exception says :  
QueryParsingException[[offlocations] field [lon] is not a geo\_point field];

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6A9B82CB-37AC-45A2-842A-703E8965D5B9%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/6A9B82CB-37AC-45A2-842A-703E8965D5B9%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Madhavan\_Ramachandra](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Madhavan\_Ramachandra](https://discuss.elastic.co/u/Madhavan_Ramachandra)\
**Post date:** [July 30, 2014, 1:48pm UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960/3 "2014-07-30T13:48:21Z")

</div>

Thanks for your response.

I am using Nest dll (.Net) to index the data in ES (in windows as a  
service). How to add the geopoint to my index columns?

Regards  
Madhavan.TR

On Tuesday, July 29, 2014 3:35:56 PM UTC-5, David Pilato wrote:

> No you can't out of the box. If you want to use built in geo filters you  
> need geo points.
> 
> That said, you can use scripts to do it based on lat,lon fields but it  
> will be slower.
> 
> My 2 cents
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 29 juil. 2014 à 22:30, Madhavan Ramachandran \<[madh...@gmail.com](mailto:madh...@gmail.com)  
> \<javascript:\>\> a écrit :
> 
> Hi Team,
> 
> I am trying to find a solution for the below
> 
> 1. Geo boundary based search.. My index have property for lat and lon  
> as double.. not as a geopoint.. Here is my mapping for my index..
> 
> How do i use the lon and lat from the below mapping for geo distance  
> filter/geo distance range filter ?
> 
> Name Type Format Store?  
> data string
> 
> getpath string
> 
> id double
> 
> Region string
> 
> Submarket string
> 
> addr1 string
> 
> addr2 string
> 
> city string
> 
> citymarket string
> 
> country string
> 
> countryid long
> 
> cultureid long
> 
> data string
> 
> details string
> 
> fax string
> 
> id string
> 
> language string
> 
> lat double
> 
> lon double
> 
> When I search for the documents.. i got the below exception..
> 
> Query :  
> {  
> "filter": {  
> "geo\_distance" : {  
> "distance" : "300km",  
> "location" : {  
> "lat" : 45,  
> "lon" : -122  
> }  
> }
> 
> }  
> }
> 
> Exception:  
> "error": "SearchPhaseExecutionException[Failed to execute phase [query],  
> all shards failed; shardFailures  
> {[o3f66HetT3OSpVw895w0nA][offlocations][4]:  
> SearchParseException[[offlocations][4]: from[-1],size[-1]: Parse Failure  
> [Failed to parse source [{\n"filter": {\n "geo\_distance" : {\n  
> "distance" : "300km",\n "location" : {\n "lat" : 45,\n "lon" :  
> -122\n }\n } \n }\n}]]]; nested:
> 
> I tried with removing the location, which i dont have in my mapping..
> 
> {"filter": { "geo\_distance" : { "distance" : "300km", "lat"  
> : 45, "lon" : -122 } }}
> 
> I got the exception as lon is not a geo\_point field..
> 
> ElasticsearchIllegalArgumentException[the character '-' is not a valid  
> geohash character]; }]"
> 
> If i remove the "-" infront of lon.. then the exception says :
> 
> QueryParsingException[[offlocations] field [lon] is not a geo\_point field];
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b0d6e420-701b-4ace-8763-9a4d2c172cdc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b0d6e420-701b-4ace-8763-9a4d2c172cdc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Madhavan\_Ramachandra](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Madhavan\_Ramachandra](https://discuss.elastic.co/u/Madhavan_Ramachandra)\
**Post date:** [July 30, 2014, 2:26pm UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960/4 "2014-07-30T14:26:15Z")

</div>

Hi

I have updated the mapping for my index.. added a column with geopoint..

locationgeo\_point  
when i search without geo filter for data.. i can able to see the location  
information.

{  
"\_index": "offlocations\_geo",  
"\_type": "officelocations",  
"\_id": "21",  
"\_score": 1,  
"\_source": {  
"countryid": 232,  
"lat": 32.8641213476658,  
"lon": -96.8086239695549,  
"id": 21,  
"cultureid": 1033,  
"country": "US",  
"id": "21-10",  
"title": "8343 Douglas Avenue",  
"getpath": "8343 Douglas Avenue",  
"topic": "",  
"details": "

Dallas, TX 75225

", "addr1": "Suite 100", "addr2": "", "city": "Dallas", "province": "TX", "zip": "75225", "Region": "Americas", "market": "", "phone": "", "fax": "+", "language": "en-us", "location": { "lat": 32.8641213476658, "lon": -96.8086239695549 } } }

When i add the geofilter query .. again getting exception..  
{  
"filtered" : {  
"query" : {  
"match\_all" : {}  
},  
"filter" : {  
"geo\_distance" : {  
"distance" : "10km",

```
            "location": {
                    "lat": 41.0453822,
                    "lon": -73.5474359
                }
                
        }
    }
}

```

}

exception info:

nested: SearchParseException[[offlocations\_geo][2]: from[-1],size[-1]:  
Parse Failure [No parser for element [filtered]]]; }]",  
"status": 400

Regards  
Madhavan.TR

On Wednesday, July 30, 2014 8:48:22 AM UTC-5, Madhavan Ramachandran wrote:

> Thanks for your response.
> 
> I am using Nest dll (.Net) to index the data in ES (in windows as a  
> service). How to add the geopoint to my index columns?
> 
> Regards  
> Madhavan.TR
> 
> On Tuesday, July 29, 2014 3:35:56 PM UTC-5, David Pilato wrote:
> 
> > No you can't out of the box. If you want to use built in geo filters you  
> > need geo points.
> > 
> > That said, you can use scripts to do it based on lat,lon fields but it  
> > will be slower.
> > 
> > My 2 cents
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 29 juil. 2014 à 22:30, Madhavan Ramachandran [madh...@gmail.com](mailto:madh...@gmail.com) a  
> > écrit :
> > 
> > Hi Team,
> > 
> > I am trying to find a solution for the below
> > 
> > 1. Geo boundary based search.. My index have property for lat and lon  
> > as double.. not as a geopoint.. Here is my mapping for my index..
> > 
> > How do i use the lon and lat from the below mapping for geo distance  
> > filter/geo distance range filter ?
> > 
> > Name Type Format Store?  
> > data string
> > 
> > getpath string
> > 
> > id double
> > 
> > Region string
> > 
> > Submarket string
> > 
> > addr1 string
> > 
> > addr2 string
> > 
> > city string
> > 
> > citymarket string
> > 
> > country string
> > 
> > countryid long
> > 
> > cultureid long
> > 
> > data string
> > 
> > details string
> > 
> > fax string
> > 
> > id string
> > 
> > language string
> > 
> > lat double
> > 
> > lon double
> > 
> > When I search for the documents.. i got the below exception..
> > 
> > Query :  
> > {  
> > "filter": {  
> > "geo\_distance" : {  
> > "distance" : "300km",  
> > "location" : {  
> > "lat" : 45,  
> > "lon" : -122  
> > }  
> > }
> > 
> > }  
> > }
> > 
> > Exception:  
> > "error": "SearchPhaseExecutionException[Failed to execute phase [query],  
> > all shards failed; shardFailures  
> > {[o3f66HetT3OSpVw895w0nA][offlocations][4]:  
> > SearchParseException[[offlocations][4]: from[-1],size[-1]: Parse Failure  
> > [Failed to parse source [{\n"filter": {\n "geo\_distance" : {\n  
> > "distance" : "300km",\n "location" : {\n "lat" : 45,\n "lon" :  
> > -122\n }\n } \n }\n}]]]; nested:
> > 
> > I tried with removing the location, which i dont have in my mapping..
> > 
> > {"filter": { "geo\_distance" : { "distance" : "300km", "lat"  
> > : 45, "lon" : -122 } }}
> > 
> > I got the exception as lon is not a geo\_point field..
> > 
> > ElasticsearchIllegalArgumentException[the character '-' is not a valid  
> > geohash character]; }]"
> > 
> > If i remove the "-" infront of lon.. then the exception says :
> > 
> > QueryParsingException[[offlocations] field [lon] is not a geo\_point  
> > field];
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/85658110-e7ae-42c5-8ca9-13f10c7f3820%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e33baf32-8841-4350-92f8-8a5306530e3f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e33baf32-8841-4350-92f8-8a5306530e3f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Joffrey\_Hercule](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@Joffrey\_Hercule](https://discuss.elastic.co/u/Joffrey_Hercule)\
**Post date:** [July 30, 2014, 3:08pm UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960/5 "2014-07-30T15:08:45Z")

</div>

Hi !  
Use "query".

ex :  
{  
"query" : {  
"filtered" : {  
"query" : {  
"match\_all" : {}  
},  
"filter" : {  
"geo\_distance" : {  
"distance" : "50km",  
"city.location" : {  
"lat" : 43.4,  
"lon" : 5.4  
}  
}  
}  
}  
}  
}

Le mardi 29 juillet 2014 22:30:12 UTC+2, Madhavan Ramachandran a écrit :

> Hi Team,
> 
> I am trying to find a solution for the below
> 
> 1. Geo boundary based search.. My index have property for lat and lon  
> as double.. not as a geopoint.. Here is my mapping for my index..
> 
> How do i use the lon and lat from the below mapping for geo distance  
> filter/geo distance range filter ?
> 
> Name Type Format Store?  
> data string
> 
> getpath string
> 
> id double
> 
> Region string
> 
> Submarket string
> 
> addr1 string
> 
> addr2 string
> 
> city string
> 
> citymarket string
> 
> country string
> 
> countryid long
> 
> cultureid long
> 
> data string
> 
> details string
> 
> fax string
> 
> id string
> 
> language string
> 
> lat double
> 
> lon double
> 
> When I search for the documents.. i got the below exception..
> 
> Query :  
> {  
> "filter": {  
> "geo\_distance" : {  
> "distance" : "300km",  
> "location" : {  
> "lat" : 45,  
> "lon" : -122  
> }  
> }
> 
> }  
> }
> 
> Exception:  
> "error": "SearchPhaseExecutionException[Failed to execute phase [query],  
> all shards failed; shardFailures  
> {[o3f66HetT3OSpVw895w0nA][offlocations][4]:  
> SearchParseException[[offlocations][4]: from[-1],size[-1]: Parse Failure  
> [Failed to parse source [{\n"filter": {\n "geo\_distance" : {\n  
> "distance" : "300km",\n "location" : {\n "lat" : 45,\n "lon" :  
> -122\n }\n } \n }\n}]]]; nested:
> 
> I tried with removing the location, which i dont have in my mapping..
> 
> {"filter": { "geo\_distance" : { "distance" : "300km", "lat"  
> : 45, "lon" : -122 } }}
> 
> I got the exception as lon is not a geo\_point field..
> 
> ElasticsearchIllegalArgumentException[the character '-' is not a valid  
> geohash character]; }]"
> 
> If i remove the "-" infront of lon.. then the exception says :
> 
> QueryParsingException[[offlocations] field [lon] is not a geo\_point field];

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/567759b4-21bb-489f-b08f-36ba982a30c8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/567759b4-21bb-489f-b08f-36ba982a30c8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Madhavan\_Ramachandra](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Madhavan\_Ramachandra](https://discuss.elastic.co/u/Madhavan_Ramachandra)\
**Post date:** [July 30, 2014, 4:13pm UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960/6 "2014-07-30T16:13:53Z")

</div>

Nope.. it did not work..got exception as  
QueryParsingException[[offlocations\_geo] failed to find geo\_point field  
[city.location

Regards  
Madhavan.TR  
On Wednesday, July 30, 2014 10:08:45 AM UTC-5, Joffrey Hercule wrote:

> Hi !  
> Use "query".
> 
> ex :  
> {  
> "query" : {  
> "filtered" : {  
> "query" : {  
> "match\_all" : {}  
> },  
> "filter" : {  
> "geo\_distance" : {  
> "distance" : "50km",  
> "city.location" : {  
> "lat" : 43.4,  
> "lon" : 5.4  
> }  
> }  
> }  
> }  
> }  
> }
> 
> Le mardi 29 juillet 2014 22:30:12 UTC+2, Madhavan Ramachandran a écrit :
> 
> > Hi Team,
> > 
> > I am trying to find a solution for the below
> > 
> > 1. Geo boundary based search.. My index have property for lat and lon  
> > as double.. not as a geopoint.. Here is my mapping for my index..
> > 
> > How do i use the lon and lat from the below mapping for geo distance  
> > filter/geo distance range filter ?
> > 
> > Name Type Format Store?  
> > data string
> > 
> > getpath string
> > 
> > id double
> > 
> > Region string
> > 
> > Submarket string
> > 
> > addr1 string
> > 
> > addr2 string
> > 
> > city string
> > 
> > citymarket string
> > 
> > country string
> > 
> > countryid long
> > 
> > cultureid long
> > 
> > data string
> > 
> > details string
> > 
> > fax string
> > 
> > id string
> > 
> > language string
> > 
> > lat double
> > 
> > lon double
> > 
> > When I search for the documents.. i got the below exception..
> > 
> > Query :  
> > {  
> > "filter": {  
> > "geo\_distance" : {  
> > "distance" : "300km",  
> > "location" : {  
> > "lat" : 45,  
> > "lon" : -122  
> > }  
> > }
> > 
> > }  
> > }
> > 
> > Exception:  
> > "error": "SearchPhaseExecutionException[Failed to execute phase [query],  
> > all shards failed; shardFailures  
> > {[o3f66HetT3OSpVw895w0nA][offlocations][4]:  
> > SearchParseException[[offlocations][4]: from[-1],size[-1]: Parse Failure  
> > [Failed to parse source [{\n"filter": {\n "geo\_distance" : {\n  
> > "distance" : "300km",\n "location" : {\n "lat" : 45,\n "lon" :  
> > -122\n }\n } \n }\n}]]]; nested:
> > 
> > I tried with removing the location, which i dont have in my mapping..
> > 
> > {"filter": { "geo\_distance" : { "distance" : "300km", "lat"  
> > : 45, "lon" : -122 } }}
> > 
> > I got the exception as lon is not a geo\_point field..
> > 
> > ElasticsearchIllegalArgumentException[the character '-' is not a valid  
> > geohash character]; }]"
> > 
> > If i remove the "-" infront of lon.. then the exception says :
> > 
> > QueryParsingException[[offlocations] field [lon] is not a geo\_point  
> > field];

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/11cd8b18-7057-4190-a3d0-463bd59b7f5a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/11cd8b18-7057-4190-a3d0-463bd59b7f5a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Joffrey\_Hercule](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@Joffrey\_Hercule](https://discuss.elastic.co/u/Joffrey_Hercule)\
**Post date:** [July 31, 2014, 7:42am UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960/7 "2014-07-31T07:42:55Z")

</div>

city.location was an example 😉  
You should use yours.

Le mercredi 30 juillet 2014 18:13:53 UTC+2, Madhavan Ramachandran a écrit :

> Nope.. it did not work..got exception as  
> QueryParsingException[[offlocations\_geo] failed to find geo\_point field  
> [city.location
> 
> Regards  
> Madhavan.TR  
> On Wednesday, July 30, 2014 10:08:45 AM UTC-5, Joffrey Hercule wrote:
> 
> > Hi !  
> > Use "query".
> > 
> > ex :  
> > {  
> > "query" : {  
> > "filtered" : {  
> > "query" : {  
> > "match\_all" : {}  
> > },  
> > "filter" : {  
> > "geo\_distance" : {  
> > "distance" : "50km",  
> > "city.location" : {  
> > "lat" : 43.4,  
> > "lon" : 5.4  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > Le mardi 29 juillet 2014 22:30:12 UTC+2, Madhavan Ramachandran a écrit :
> > 
> > > Hi Team,
> > > 
> > > I am trying to find a solution for the below
> > > 
> > > 1. Geo boundary based search.. My index have property for lat and  
> > > lon as double.. not as a geopoint.. Here is my mapping for my index..
> > > 
> > > How do i use the lon and lat from the below mapping for geo distance  
> > > filter/geo distance range filter ?
> > > 
> > > Name Type Format Store?  
> > > data string
> > > 
> > > getpath string
> > > 
> > > id double
> > > 
> > > Region string
> > > 
> > > Submarket string
> > > 
> > > addr1 string
> > > 
> > > addr2 string
> > > 
> > > city string
> > > 
> > > citymarket string
> > > 
> > > country string
> > > 
> > > countryid long
> > > 
> > > cultureid long
> > > 
> > > data string
> > > 
> > > details string
> > > 
> > > fax string
> > > 
> > > id string
> > > 
> > > language string
> > > 
> > > lat double
> > > 
> > > lon double
> > > 
> > > When I search for the documents.. i got the below exception..
> > > 
> > > Query :  
> > > {  
> > > "filter": {  
> > > "geo\_distance" : {  
> > > "distance" : "300km",  
> > > "location" : {  
> > > "lat" : 45,  
> > > "lon" : -122  
> > > }  
> > > }
> > > 
> > > }  
> > > }
> > > 
> > > Exception:  
> > > "error": "SearchPhaseExecutionException[Failed to execute phase [query],  
> > > all shards failed; shardFailures  
> > > {[o3f66HetT3OSpVw895w0nA][offlocations][4]:  
> > > SearchParseException[[offlocations][4]: from[-1],size[-1]: Parse Failure  
> > > [Failed to parse source [{\n"filter": {\n "geo\_distance" : {\n  
> > > "distance" : "300km",\n "location" : {\n "lat" : 45,\n "lon" :  
> > > -122\n }\n } \n }\n}]]]; nested:
> > > 
> > > I tried with removing the location, which i dont have in my mapping..
> > > 
> > > {"filter": { "geo\_distance" : { "distance" : "300km", "lat"  
> > > : 45, "lon" : -122 } }}
> > > 
> > > I got the exception as lon is not a geo\_point field..
> > > 
> > > ElasticsearchIllegalArgumentException[the character '-' is not a valid  
> > > geohash character]; }]"
> > > 
> > > If i remove the "-" infront of lon.. then the exception says :
> > > 
> > > QueryParsingException[[offlocations] field [lon] is not a geo\_point  
> > > field];

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a95b2a60-6f4d-4727-9b38-67cfd4329465%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a95b2a60-6f4d-4727-9b38-67cfd4329465%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:12am UTC](https://discuss.elastic.co/t/geo-distance-filter-exceptions/18960/8 "2017-07-06T01:12:02Z")

</div>


