# Geo location search

**URL:** <https://discuss.elastic.co/t/geo-location-search/8968>\
**Category:** Elasticsearch\
**Created:** [September 10, 2012, 4:43am UTC](https://discuss.elastic.co/t/geo-location-search/8968 "2012-09-10T04:43:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Renu\_y\_2](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@Renu\_y\_2](https://discuss.elastic.co/u/Renu_y_2)\
**Post date:** [September 10, 2012, 4:43am UTC](https://discuss.elastic.co/t/geo-location-search/8968/1 "2012-09-10T04:43:13Z")

</div>

Hi,

On querying a document using the geolocation filter, the distance I am  
giving in 5km (search in the radius on 5 kms)  
However, the results comeback with 10 kms away geopoints too. by trial i  
found out that It does not show places which are beyond 22 kms.  
However I would like to restrict it to 5 kms.

Whatever could be wrong here?

Query:

curl -X GET "  
[http://localhost:9200/app\_places/\_search?from=0&load=true&size=10&pretty=true](http://localhost:9200/app_places/_search?from=0&load=true&size=10&pretty=true)"  
-d '{"query":{"text":{"name\_exact":{"query":"cafe coffee  
day"}}},"filter":{"geo\_distance":{"lat\_lon":[_28.5190713,77.383332]_  
,"distance\_type":"arc","distance":"5km"}},"size":10,"from":0}'

The response I get is:

{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 3,  
"max\_score" : 3.6822338,  
"hits" : [ {  
"\_index" : "app\_places",  
"\_type" : "place",  
"\_id" : "504d6e17678474f076979f95",  
"\_score" : 3.6822338, "\_source" : {"name":"Cafe Coffee Day","lat\_lon":  
_[28.60916139,77.383332]_,"name\_phonex":"Cafe Coffee  
Day","name\_exact":"Cafe Coffee Day","name\_partial":"Cafe Coffee Day"}  
}, {  
"\_index" : "app\_places",  
"\_type" : "place",  
"\_id" : "504d6e17678474f076979f94",  
"\_score" : 3.6822338, "\_source" : {"name":"Cafe Coffee  
Day","lat\_lon":[28.564116345,77.383332],"name\_phonex":"Cafe Coffee  
Day","name\_exact":"Cafe Coffee Day","name\_partial":"Cafe Coffee Day"}  
}, {  
"\_index" : "app\_places",  
"\_type" : "place",  
"\_id" : "504d6e17678474f076979f92",  
"\_score" : 3.6822338, "\_source" : {"name":"Cafe Coffee  
Day","lat\_lon":[28.5190713,77.383332],"name\_phonex":"Cafe Coffee  
Day","name\_exact":"Cafe Coffee Day","name\_partial":"Cafe Coffee Day"}  
} ]  
}

--

---

<div class="post-metadata">

**Author:** ![Renu\_y](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@Renu\_y](https://discuss.elastic.co/u/Renu_y)\
**Post date:** [September 13, 2012, 9:49am UTC](https://discuss.elastic.co/t/geo-location-search/8968/2 "2012-09-13T09:49:44Z")

</div>

Changed the distance\_type to "plane" and it worked as required.

And I thought "arc" would be more accurate!

---

<div class="post-metadata">

**Author:** ![Renu\_y\_2](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@Renu\_y\_2](https://discuss.elastic.co/u/Renu_y_2)\
**Post date:** [September 13, 2012, 9:55am UTC](https://discuss.elastic.co/t/geo-location-search/8968/3 "2012-09-13T09:55:32Z")

</div>

Changed the distance\_type to "plane" and it worked as required.

And I thought "arc" would be more accurate!

On Monday, September 10, 2012 10:13:15 AM UTC+5:30, Renu Y wrote:

> Hi,
> 
> On querying a document using the geolocation filter, the distance I am  
> giving in 5km (search in the radius on 5 kms)  
> However, the results comeback with 10 kms away geopoints too. by trial i  
> found out that It does not show places which are beyond 22 kms.  
> However I would like to restrict it to 5 kms.
> 
> Whatever could be wrong here?
> 
> Query:
> 
> curl -X GET "  
> [http://localhost:9200/app\_places/\_search?from=0&load=true&size=10&pretty=true](http://localhost:9200/app_places/_search?from=0&load=true&size=10&pretty=true)"  
> -d '{"query":{"text":{"name\_exact":{"query":"cafe coffee  
> day"}}},"filter":{"geo\_distance":{"lat\_lon":[_28.5190713,77.383332]_  
> ,"distance\_type":"arc","distance":"5km"}},"size":10,"from":0}'
> 
> The response I get is:
> 
> {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 3,  
> "max\_score" : 3.6822338,  
> "hits" : [ {  
> "\_index" : "app\_places",  
> "\_type" : "place",  
> "\_id" : "504d6e17678474f076979f95",  
> "\_score" : 3.6822338, "\_source" : {"name":"Cafe Coffee  
> Day","lat\_lon":_[28.60916139,77.383332]_,"name\_phonex":"Cafe Coffee  
> Day","name\_exact":"Cafe Coffee Day","name\_partial":"Cafe Coffee Day"}  
> }, {  
> "\_index" : "app\_places",  
> "\_type" : "place",  
> "\_id" : "504d6e17678474f076979f94",  
> "\_score" : 3.6822338, "\_source" : {"name":"Cafe Coffee  
> Day","lat\_lon":[28.564116345,77.383332],"name\_phonex":"Cafe Coffee  
> Day","name\_exact":"Cafe Coffee Day","name\_partial":"Cafe Coffee Day"}  
> }, {  
> "\_index" : "app\_places",  
> "\_type" : "place",  
> "\_id" : "504d6e17678474f076979f92",  
> "\_score" : 3.6822338, "\_source" : {"name":"Cafe Coffee  
> Day","lat\_lon":[28.5190713,77.383332],"name\_phonex":"Cafe Coffee  
> Day","name\_exact":"Cafe Coffee Day","name\_partial":"Cafe Coffee Day"}  
> } ]  
> }

--

---

<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:12am UTC](https://discuss.elastic.co/t/geo-location-search/8968/4 "2017-07-06T03:12:55Z")

</div>


