# Elastic search GEO localization

**URL:** https://discuss.elastic.co/t/elastic-search-geo-localization/17624
**Category:** Elasticsearch
**Created:** [May 20, 2014, 2:04pm UTC](https://discuss.elastic.co/t/elastic-search-geo-localization/17624 "2014-05-20T14:04:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Diaconescu\_Stefan\_An](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diaconescu_stefan_an/32/42165_2.png) [@Diaconescu\_Stefan\_An](https://discuss.elastic.co/u/Diaconescu_Stefan_An)
#### Post date: [May 20, 2014, 2:04pm UTC](https://discuss.elastic.co/t/elastic-search-geo-localization/17624/1 "2014-05-20T14:04:48Z")

</div>

Hello,

We are working on a project that will use Elastic Search for search.  
We do not have previous experience with it, but verry little using Solr.  
I have some problems with Geo Localization for search, with which i never  
had any contact in the past.  
I will try to put thinks simple so i can ask specific questions:

## Current situation:

1. Data structure of a document, indexed into ES:

{  
...........................  
"location" : {  
"type" : "point",  
"coordinates" : [-67.97224, -38.94410]  
},  
"Latitude" : "-38.94410",  
"Longitude" : "-67.97224",  
.............................  
}'

1. ES mappings for Geo Localization  
........................  
"location" : {  
"type": "geo\_shape",  
"tree": "geohash",  
"precision": "1m"  
}  
.............................

2. Query that i try to use to find all documents within a rectangle defined  
by coordinates; something like this is what we think we need to search  
nearby documents, geographically near other documents:

curl -XPOST "[http://10.0.30.99:9200/\_search?pretty](http://10.0.30.99:9200/_search?pretty)"[http://10.0.30.99:9200/\_search?pretty](http://10.0.30.99:9200/_search?pretty)-d'  
{  
"query":{  
"filtered": {  
"query": {  
"match\_all": {}  
},  
"filter": {  
"geo\_shape": {  
"location": {  
"shape": {  
"type": "envelope",  
"coordinates" : [[-59.0, -35.0], [-58.0, -34.0]]  
}  
}  
}  
}  
}  
}  
}'

And i get an error from ES:

..................................  
nested: InvalidShapeException[maxY must be \>= minY: -34.0 to -35.0]  
.......................................

1. Questions

a. At error from point 3, from what i understand ES complains that -34.0  
must be greater or equal to -35, which is the case (they are negative  
numbers), so why does ES complain ? Is this query ok ?  
b. Is the approach used to find documents which are geographically near  
other documents, that we used ok, and what fixes, improvements,  
alternatives do you suggest ?  
c. Could you recommend a good reference documentation/help/tutorial for GEO  
localization (but not only) in ES ?

Thank you !

--  
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/1b93a23b-9909-46de-ab56-85882358d547%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b93a23b-9909-46de-ab56-85882358d547%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:28am UTC](https://discuss.elastic.co/t/elastic-search-geo-localization/17624/2 "2017-07-06T01:28:07Z")

</div>


