# Geo search not working for current version of ElasticSearch (\< 0.11.0)

**URL:** <https://discuss.elastic.co/t/geo-search-not-working-for-current-version-of-elasticsearch-0-11-0/3887>\
**Category:** Elasticsearch\
**Created:** [February 5, 2011, 1:02am UTC](https://discuss.elastic.co/t/geo-search-not-working-for-current-version-of-elasticsearch-0-11-0/3887 "2011-02-05T01:02:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![digsmahler](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@digsmahler](https://discuss.elastic.co/u/digsmahler)\
**Post date:** [February 5, 2011, 1:02am UTC](https://discuss.elastic.co/t/geo-search-not-working-for-current-version-of-elasticsearch-0-11-0/3887/1 "2011-02-05T01:02:50Z")

</div>

I am very new to ElasticSearch, and trying to test the geo  
functionality. I've looked at the documentation and other posts and  
cobbled together a test that fails on 0.14.4. Going back through the  
older versions, the following test does work with 0.11.0. I understand  
the geo functionality changed with the bump to 0.12.0, but I cannot  
figure out how the new syntax is supposed to work.

curl -XPUT '[http://localhost:9200/test/](http://localhost:9200/test/)'

curl -XPUT '[http://localhost:9200/test/pins/\_mapping](http://localhost:9200/test/pins/_mapping)' -d '{  
"pin" : {  
"properties" : {  
"location" : {  
"type" : "geo\_point"  
}  
}  
}  
}'

curl -XGET '[http://localhost:9200/test/pins/\_mapping?pretty=true](http://localhost:9200/test/pins/_mapping?pretty=true)'

curl -XPUT '[http://localhost:9200/test/pins/1](http://localhost:9200/test/pins/1)' -d '{  
"pin" : {  
"location" : {  
"lat" : 40.12,  
"lon" : -71.34  
},  
"tag" : ["food", "family"],  
"text" : "my favorite family restaurant"  
}  
}'

curl -XGET '[http://localhost:9200/test/pins/\_search](http://localhost:9200/test/pins/_search)' -d '{  
"query" : {  
"filtered" : {  
"query" : {  
"field" : { "text" : "restaurant" }  
},  
"filter" : {  
"geo\_distance" : {  
"distance" : "120km",  
"pin.location" : {  
"lat" : 40,  
"lon" : -70  
}  
}  
}  
}  
}  
}'

Result:

{"error":"SearchPhaseExecutionException[Failed to execute phase  
[query], total failure; shardFailures {[PSO9xzYtTPapsrT\_ihhv\_Q][test]  
[0]: SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure  
[Failed to parse source [{\n "query" : { \n "filtered" :  
{ \n "query" : { \n "field" : { "text" : "restaurant  
" } \n }, \n "filter" : { \n "geo\_distance" :  
{ \n "distance" : "120km", \n "pin.location" :  
{ \n "lat" : 40, \n "lon" : -70 \n }  
\n }\n }\n }\n }\n}]]]; nested:  
QueryParsingException[[test] failed to find geo\_point field  
[pin.location]]; }{[PSO9xzYtTPapsrT\_ihhv\_Q][test][1]:  
SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure  
[Failed to parse source [{\n "query" : { \n "filtered" :  
{ \n "query" : { \n "field" : { "text" : "restaurant  
" } \n }, \n "filter" : { \n "geo\_distance" :  
{ \n "distance" : "120km", \n "pin.location" :  
{ \n "lat" : 40, \n "lon" : -70 \n }  
\n }\n }\n }\n }\n}]]]; nested:  
QueryParsingException[[test] failed to find geo\_point field  
[pin.location]]; }{[PSO9xzYtTPapsrT\_ihhv\_Q][test][2]:  
SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure  
[Failed to parse source [{\n "query" : { \n "filtered" :  
{ \n "query" : { \n "field" : { "text" : "restaurant  
" } \n }, \n "filter" : { \n "geo\_distance" :  
{ \n "distance" : "120km", \n "pin.location" :  
{ \n "lat" : 40, \n "lon" : -70 \n }  
\n }\n }\n }\n }\n}]]]; nested:  
QueryParsingException[[test] failed to find geo\_point field  
[pin.location]]; }{[PSO9xzYtTPapsrT\_ihhv\_Q][test][3]:  
SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure  
[Failed to parse source [{\n "query" : { \n "filtered" :  
{ \n "query" : { \n "field" : { "text" : "restaurant  
" } \n }, \n "filter" : { \n "geo\_distance" :  
{ \n "distance" : "120km", \n "pin.location" :  
{ \n "lat" : 40, \n "lon" : -70 \n }  
\n }\n }\n }\n }\n}]]]; nested:  
QueryParsingException[[test] failed to find geo\_point field  
[pin.location]]; }{[PSO9xzYtTPapsrT\_ihhv\_Q][test][4]:  
SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure  
[Failed to parse source [{\n "query" : { \n "filtered" :  
{ \n "query" : { \n "field" : { "text" : "restaurant  
" } \n }, \n "filter" : { \n "geo\_distance" :  
{ \n "distance" : "120km", \n "pin.location" :  
{ \n "lat" : 40, \n "lon" : -70 \n }  
\n }\n }\n }\n }\n}]]]; nested:  
QueryParsingException[[test] failed to find geo\_point field  
[pin.location]]; }]"}

From the log (one for each shard):

[2011-02-04 16:58:49,392][DEBUG][action.search.type] [Magik]  
[test][0], node[PSO9xzYtTPapsrT\_ihhv\_Q], [P], s[STARTED]: Failed to  
execute [org.elasticsearch.action.search.SearchRequest@7654a50]  
org.elasticsearch.search.SearchParseException: [test][0]:  
from[-1],size[-1]: Parse Failure [Failed to parse source [{  
"query" : {  
"filtered" : {  
"query" : {  
"field" : { "text" : "restaurant" }  
},  
"filter" : {  
"geo\_distance" : {  
"distance" : "120km",  
"pin.location" : {  
"lat" : 40,  
"lon" : -70  
}  
}  
}  
}  
}  
}]]  
at  
org.elasticsearch.search.SearchService.parseSource(SearchService.java:  
420)  
at  
org.elasticsearch.search.SearchService.createContext(SearchService.java:  
335)  
at  
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:  
169)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
131)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction  
$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
76)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:193)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction  
$BaseAsyncAction$1.run(TransportSearchTypeAction.java:152)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.runTask(ThreadPoolExecutor.java:886)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:680)  
Caused by: org.elasticsearch.index.query.QueryParsingException: [test]  
failed to find geo\_point field [pin.location]  
at  
org.elasticsearch.index.query.xcontent.GeoDistanceFilterParser.parse(GeoDistanceFilterParser.java:  
163)  
at  
org.elasticsearch.index.query.xcontent.QueryParseContext.parseInnerFilter(QueryParseContext.java:  
193)  
at  
org.elasticsearch.index.query.xcontent.FilteredQueryParser.parse(FilteredQueryParser.java:  
67)  
at  
org.elasticsearch.index.query.xcontent.QueryParseContext.parseInnerQuery(QueryParseContext.java:  
167)  
at  
org.elasticsearch.index.query.xcontent.XContentIndexQueryParser.parse(XContentIndexQueryParser.java:  
234)  
at  
org.elasticsearch.index.query.xcontent.XContentIndexQueryParser.parse(XContentIndexQueryParser.java:  
214)  
at  
org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:  
34)  
at  
org.elasticsearch.search.SearchService.parseSource(SearchService.java:  
407)  
... 10 more

Other relevant links, none of which are helping me grok this:

> <https://github.com/elastic/elasticsearch/issues/414>

  
[http://elasticsearch-users.115913.n3.nabble.com/Problem-with-geo-distance-filter-td1576354.html](http://elasticsearch-users.115913.n3.nabble.com/Problem-with-geo-distance-filter-td1576354.html)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 7, 2011, 6:13pm UTC](https://discuss.elastic.co/t/geo-search-not-working-for-current-version-of-elasticsearch-0-11-0/3887/2 "2011-02-07T18:13:26Z")

</div>

You mapping was not processed because the top level name is "pin" and not "pins". You can always do a get mapping to check the actual mapping for a type in an index ES has.  
On Saturday, February 5, 2011 at 3:02 AM, digsmahler wrote:

> I am very new to Elasticsearch, and trying to test the geo  
> functionality. I've looked at the documentation and other posts and  
> cobbled together a test that fails on 0.14.4. Going back through the  
> older versions, the following test does work with 0.11.0. I understand  
> the geo functionality changed with the bump to 0.12.0, but I cannot  
> figure out how the new syntax is supposed to work.
> 
> curl -XPUT '[http://localhost:9200/test/](http://localhost:9200/test/)'
> 
> curl -XPUT '[http://localhost:9200/test/pins/\_mapping](http://localhost:9200/test/pins/_mapping)' -d '{  
> "pin" : {  
> "properties" : {  
> "location" : {  
> "type" : "geo\_point"  
> }  
> }  
> }  
> }'
> 
> curl -XGET '[http://localhost:9200/test/pins/\_mapping?pretty=true](http://localhost:9200/test/pins/_mapping?pretty=true)'
> 
> curl -XPUT '[http://localhost:9200/test/pins/1](http://localhost:9200/test/pins/1)' -d '{  
> "pin" : {  
> "location" : {  
> "lat" : 40.12,  
> "lon" : -71.34  
> },  
> "tag" : ["food", "family"],  
> "text" : "my favorite family restaurant"  
> }  
> }'
> 
> curl -XGET '[http://localhost:9200/test/pins/\_search](http://localhost:9200/test/pins/_search)' -d '{  
> "query" : {  
> "filtered" : {  
> "query" : {  
> "field" : { "text" : "restaurant" }  
> },  
> "filter" : {  
> "geo\_distance" : {  
> "distance" : "120km",  
> "pin.location" : {  
> "lat" : 40,  
> "lon" : -70  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> Result:
> 
> {"error":"SearchPhaseExecutionException[Failed to execute phase  
> [query], total failure; shardFailures {[PSO9xzYtTPapsrT\_ihhv\_Q][test]  
> [0]: SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure  
> [Failed to parse source [{\n "query" : { \n "filtered" :  
> { \n "query" : { \n "field" : { "text" : "restaurant  
> " } \n }, \n "filter" : { \n "geo\_distance" :  
> { \n "distance" : "120km", \n "pin.location" :  
> { \n "lat" : 40, \n "lon" : -70 \n }  
> \n }\n }\n }\n }\n}]]]; nested:  
> QueryParsingException[[test] failed to find geo\_point field  
> [pin.location]]; }{[PSO9xzYtTPapsrT\_ihhv\_Q][test][1]:  
> SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure  
> [Failed to parse source [{\n "query" : { \n "filtered" :  
> { \n "query" : { \n "field" : { "text" : "restaurant  
> " } \n }, \n "filter" : { \n "geo\_distance" :  
> { \n "distance" : "120km", \n "pin.location" :  
> { \n "lat" : 40, \n "lon" : -70 \n }  
> \n }\n }\n }\n }\n}]]]; nested:  
> QueryParsingException[[test] failed to find geo\_point field  
> [pin.location]]; }{[PSO9xzYtTPapsrT\_ihhv\_Q][test][2]:  
> SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure  
> [Failed to parse source [{\n "query" : { \n "filtered" :  
> { \n "query" : { \n "field" : { "text" : "restaurant  
> " } \n }, \n "filter" : { \n "geo\_distance" :  
> { \n "distance" : "120km", \n "pin.location" :  
> { \n "lat" : 40, \n "lon" : -70 \n }  
> \n }\n }\n }\n }\n}]]]; nested:  
> QueryParsingException[[test] failed to find geo\_point field  
> [pin.location]]; }{[PSO9xzYtTPapsrT\_ihhv\_Q][test][3]:  
> SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure  
> [Failed to parse source [{\n "query" : { \n "filtered" :  
> { \n "query" : { \n "field" : { "text" : "restaurant  
> " } \n }, \n "filter" : { \n "geo\_distance" :  
> { \n "distance" : "120km", \n "pin.location" :  
> { \n "lat" : 40, \n "lon" : -70 \n }  
> \n }\n }\n }\n }\n}]]]; nested:  
> QueryParsingException[[test] failed to find geo\_point field  
> [pin.location]]; }{[PSO9xzYtTPapsrT\_ihhv\_Q][test][4]:  
> SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure  
> [Failed to parse source [{\n "query" : { \n "filtered" :  
> { \n "query" : { \n "field" : { "text" : "restaurant  
> " } \n }, \n "filter" : { \n "geo\_distance" :  
> { \n "distance" : "120km", \n "pin.location" :  
> { \n "lat" : 40, \n "lon" : -70 \n }  
> \n }\n }\n }\n }\n}]]]; nested:  
> QueryParsingException[[test] failed to find geo\_point field  
> [pin.location]]; }]"}
> 
> From the log (one for each shard):
> 
> [2011-02-04 16:58:49,392][DEBUG][action.search.type] [Magik]  
> [test][0], node[PSO9xzYtTPapsrT\_ihhv\_Q], [P], s[STARTED]: Failed to  
> execute [org.elasticsearch.action.search.SearchRequest@7654a50]  
> org.elasticsearch.search.SearchParseException: [test][0]:  
> from[-1],size[-1]: Parse Failure [Failed to parse source [{  
> "query" : {  
> "filtered" : {  
> "query" : {  
> "field" : { "text" : "restaurant" }  
> },  
> "filter" : {  
> "geo\_distance" : {  
> "distance" : "120km",  
> "pin.location" : {  
> "lat" : 40,  
> "lon" : -70  
> }  
> }  
> }  
> }  
> }  
> }]]  
> at  
> org.elasticsearch.search.SearchService.parseSource(SearchService.java:  
> 420)  
> at  
> org.elasticsearch.search.SearchService.createContext(SearchService.java:  
> 335)  
> at  
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:  
> 169)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:  
> 131)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction  
> $AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:  
> 76)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:193)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction.access$000(TransportSearchTypeAction.java:77)  
> at org.elasticsearch.action.search.type.TransportSearchTypeAction  
> $BaseAsyncAction$1.run(TransportSearchTypeAction.java:152)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.runTask(ThreadPoolExecutor.java:886)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:680)  
> Caused by: org.elasticsearch.index.query.QueryParsingException: [test]  
> failed to find geo\_point field [pin.location]  
> at  
> org.elasticsearch.index.query.xcontent.GeoDistanceFilterParser.parse(GeoDistanceFilterParser.java:  
> 163)  
> at  
> org.elasticsearch.index.query.xcontent.QueryParseContext.parseInnerFilter(QueryParseContext.java:  
> 193)  
> at  
> org.elasticsearch.index.query.xcontent.FilteredQueryParser.parse(FilteredQueryParser.java:  
> 67)  
> at  
> org.elasticsearch.index.query.xcontent.QueryParseContext.parseInnerQuery(QueryParseContext.java:  
> 167)  
> at  
> org.elasticsearch.index.query.xcontent.XContentIndexQueryParser.parse(XContentIndexQueryParser.java:  
> 234)  
> at  
> org.elasticsearch.index.query.xcontent.XContentIndexQueryParser.parse(XContentIndexQueryParser.java:  
> 214)  
> at  
> org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:  
> 34)  
> at  
> org.elasticsearch.search.SearchService.parseSource(SearchService.java:  
> 407)  
> ... 10 more
> 
> Other relevant links, none of which are helping me grok this:
> 
> [Geo Overhaul (work with multiple locations) · Issue #414 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/issue/414)  
> [http://elasticsearch-users.115913.n3.nabble.com/Problem-with-geo-distance-filter-td1576354.html](http://elasticsearch-users.115913.n3.nabble.com/Problem-with-geo-distance-filter-td1576354.html)

---

<div class="post-metadata">

**Author:** ![digsmahler](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@digsmahler](https://discuss.elastic.co/u/digsmahler)\
**Post date:** [February 7, 2011, 6:51pm UTC](https://discuss.elastic.co/t/geo-search-not-working-for-current-version-of-elasticsearch-0-11-0/3887/3 "2011-02-07T18:51:48Z")

</div>

Solved. Thank you!

---

<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, 4:12am UTC](https://discuss.elastic.co/t/geo-search-not-working-for-current-version-of-elasticsearch-0-11-0/3887/4 "2017-07-06T04:12:25Z")

</div>


