# Search result sorted by nearest city using longitude and latitude

**URL:** <https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283>\
**Category:** Elasticsearch\
**Created:** [November 6, 2013, 6:10am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283 "2013-11-06T06:10:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![vallabh\_2](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vallabh\_2](https://discuss.elastic.co/u/vallabh_2)\
**Post date:** [November 6, 2013, 6:10am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/1 "2013-11-06T06:10:06Z")

</div>

Dear All,

I want to develop functionality to display results sorted by nearest city  
using latitude and longitude.

For ex,  
I have default city selected lets says, London whose latitude and longitude  
is 51.50015200,-0.12623600  
So i want to display result from London sorted by nearest city.  
All result is having latitude and longitude.

But i am unable to develop in elastic search.

Any suggestions will be highly appreciated.

Thanks,  
Vallabh

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [November 6, 2013, 6:39am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/2 "2013-11-06T06:39:23Z")

</div>

Are you looking for this? [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#\_geo\_distance\_sorting](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_geo_distance_sorting)

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

Le 6 nov. 2013 à 07:10, [vallabh@wcities.com](mailto:vallabh@wcities.com) a écrit :

Dear All,

I want to develop functionality to display results sorted by nearest city using latitude and longitude.

For ex,  
I have default city selected lets says, London whose latitude and longitude is 51.50015200,-0.12623600  
So i want to display result from London sorted by nearest city.  
All result is having latitude and longitude.

But i am unable to develop in elastic search.

Any suggestions will be highly appreciated.

## Thanks, Vallabh

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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vallabh\_2](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vallabh\_2](https://discuss.elastic.co/u/vallabh_2)\
**Post date:** [November 6, 2013, 10:20am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/3 "2013-11-06T10:20:56Z")

</div>

Thanks for the reply.  
Basically, i wanted to search by latitude and longitude.

I am getting this data,

Array  
(  
[id] =\> 785629  
[title] =\> test  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 1,  
[catid] =\> 2,  
[subcatid] =\> -1,  
[created] =\> 2013-01-07 10:47:48  
[created\_by] =\> 119  
[modified] =\> 2013-04-24 01:41:59  
[modified\_by] =\> 173  
[cityid] =\> 5887  
[latitude] =\> 19.18667600  
[longitude] =\> 72.83363880  
)

If i have selected city London (51.50015200,-0.12623600), then i should be  
getting nearest result from london itself.

Below is my code,  
$result = $es-\>search(array(  
"query" =\> array(  
"dis\_max" =\> array(  
"queries" =\> array(  
0 =\> array(  
"field" =\> array(  
"title" =\> $search //search value  
)  
)  
)  
)  
),  
"from" =\> 0,  
"size" =\> 100000  
)  
);

On Wednesday, November 6, 2013 12:09:23 PM UTC+5:30, David Pilato wrote:

> Are you looking for this?  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_geo_distance_sorting)
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 6 nov. 2013 à 07:10, [val...@wcities.com](mailto:val...@wcities.com) \<javascript:\> a écrit :
> 
> Dear All,
> 
> I want to develop functionality to display results sorted by nearest city  
> using latitude and longitude.
> 
> For ex,  
> I have default city selected lets says, London whose latitude and  
> longitude is 51.50015200,-0.12623600  
> So i want to display result from London sorted by nearest city.  
> All result is having latitude and longitude.
> 
> But i am unable to develop in Elasticsearch.
> 
> Any suggestions will be highly appreciated.
> 
> Thanks,  
> Vallabh
> 
> --  
> 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:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [November 6, 2013, 10:32am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/4 "2013-11-06T10:32:06Z")

</div>

Could you illustrate your example by gisting a full curl recreation?

I think reading your code that you are not using geo\_points in your mapping but I may be wrong.

A curl recreation should help to understand what you are doing and how.

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

Le 6 nov. 2013 à 11:20, [vallabh@wcities.com](mailto:vallabh@wcities.com) a écrit :

> Thanks for the reply.  
> Basically, i wanted to search by latitude and longitude.
> 
> I am getting this data,  
> Array  
> (  
> [id] =\> 785629  
> [title] =\> test  
> [alias] =\> test  
> [state] =\> 1  
> [sectionid] =\> 1,  
> [catid] =\> 2,  
> [subcatid] =\> -1,  
> [created] =\> 2013-01-07 10:47:48  
> [created\_by] =\> 119  
> [modified] =\> 2013-04-24 01:41:59  
> [modified\_by] =\> 173  
> [cityid] =\> 5887  
> [latitude] =\> 19.18667600  
> [longitude] =\> 72.83363880  
> )  
> If i have selected city London (51.50015200,-0.12623600), then i should be getting nearest result from london itself.
> 
> Below is my code,  
> $result = $es-\>search(array(  
> "query" =\> array(  
> "dis\_max" =\> array(  
> "queries" =\> array(  
> 0 =\> array(  
> "field" =\> array(  
> "title" =\> $search //search value  
> )  
> )  
> )  
> )  
> ),  
> "from" =\> 0,  
> "size" =\> 100000  
> )  
> );
> 
> On Wednesday, November 6, 2013 12:09:23 PM UTC+5:30, David Pilato wrote:
> 
> > Are you looking for this? [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_geo_distance_sorting)
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 6 nov. 2013 à 07:10, [val...@wcities.com](mailto:val...@wcities.com) a écrit :
> > 
> > Dear All,
> > 
> > I want to develop functionality to display results sorted by nearest city using latitude and longitude.
> > 
> > For ex,  
> > I have default city selected lets says, London whose latitude and longitude is 51.50015200,-0.12623600  
> > So i want to display result from London sorted by nearest city.  
> > All result is having latitude and longitude.
> > 
> > But i am unable to develop in Elasticsearch.
> > 
> > Any suggestions will be highly appreciated.
> > 
> > ## Thanks, Vallabh
> > 
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vallabh\_2](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vallabh\_2](https://discuss.elastic.co/u/vallabh_2)\
**Post date:** [November 6, 2013, 11:04am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/5 "2013-11-06T11:04:28Z")

</div>

Thanks for the quick suggestions,

I am new in Elasticsearch and yes i am not using geo\_points in mapping.

I have attached 2 files named,

1. process\_venue.sh - which is responsible for indexing and mapping.
2. venue\_display.php - Responsible for displaying the data when click on  
search button.

As stated previous my data is coming this way,

Array  
(  
[id] =\> 178014  
[title] =\> Test  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 9,  
[catid] =\> 111,,  
[subcatid] =\> -1,,  
[created] =\> 1999-11-30 00:00:00  
[created\_by] =\> 78  
[modified] =\> 2013-04-24 01:41:59  
[modified\_by] =\> 173  
[cityid] =\> 28  
[latitude] =\> 45.49927930  
[longitude] =\> 9.12125800  
)

Array  
(  
[id] =\> 664009  
[title] =\> Test,  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 9,  
[catid] =\> 96,  
[subcatid] =\> 219,  
[created] =\> 2010-06-28 18:55:51  
[created\_by] =\> 204  
[modified] =\> 0000-00-00 00:00:00  
[modified\_by] =\> 0  
[cityid] =\> 80  
[latitude] =\> 35.66904600  
[longitude] =\> 139.70728060  
)

Thanks,  
Vallabh

On Wednesday, November 6, 2013 4:02:06 PM UTC+5:30, David Pilato wrote:

> Could you illustrate your example by gisting a full curl recreation?
> 
> I think reading your code that you are not using geo\_points in your  
> mapping but I may be wrong.
> 
> A curl recreation should help to understand what you are doing and how.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 6 nov. 2013 à 11:20, [val...@wcities.com](mailto:val...@wcities.com) \<javascript:\> a écrit :
> 
> Thanks for the reply.  
> Basically, i wanted to search by latitude and longitude.
> 
> I am getting this data,
> 
> Array  
> (  
> [id] =\> 785629  
> [title] =\> test  
> [alias] =\> test  
> [state] =\> 1  
> [sectionid] =\> 1,  
> [catid] =\> 2,  
> [subcatid] =\> -1,  
> [created] =\> 2013-01-07 10:47:48  
> [created\_by] =\> 119  
> [modified] =\> 2013-04-24 01:41:59  
> [modified\_by] =\> 173  
> [cityid] =\> 5887  
> [latitude] =\> 19.18667600  
> [longitude] =\> 72.83363880  
> )
> 
> If i have selected city London (51.50015200,-0.12623600), then i should be  
> getting nearest result from london itself.
> 
> Below is my code,  
> $result = $es-\>search(array(  
> "query" =\> array(  
> "dis\_max" =\> array(  
> "queries" =\> array(  
> 0 =\> array(  
> "field" =\> array(  
> "title" =\> $search //search value  
> )  
> )  
> )  
> )  
> ),  
> "from" =\> 0,  
> "size" =\> 100000  
> )  
> );
> 
> On Wednesday, November 6, 2013 12:09:23 PM UTC+5:30, David Pilato wrote:
> 
> > Are you looking for this?  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_geo_distance_sorting)
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 6 nov. 2013 à 07:10, [val...@wcities.com](mailto:val...@wcities.com) a écrit :
> > 
> > Dear All,
> > 
> > I want to develop functionality to display results sorted by nearest city  
> > using latitude and longitude.
> > 
> > For ex,  
> > I have default city selected lets says, London whose latitude and  
> > longitude is 51.50015200,-0.12623600  
> > So i want to display result from London sorted by nearest city.  
> > All result is having latitude and longitude.
> > 
> > But i am unable to develop in Elasticsearch.
> > 
> > Any suggestions will be highly appreciated.
> > 
> > Thanks,  
> > Vallabh
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [November 6, 2013, 11:14am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/6 "2013-11-06T11:14:24Z")

</div>

So you answered yourself to your questions I guess. If you want to use geo distance sorting then you have to use geo\_points in your mapping and create documents with proper geo fields.

This should help as well: [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

6 novembre 2013 at 12:04:33, [vallabh@wcities.com](mailto:vallabh@wcities.com) ([vallabh@wcities.com](mailto:vallabh@wcities.com)) a écrit:

Thanks for the quick suggestions,

I am new in elastic search and yes i am not using geo\_points in mapping.

I have attached 2 files named,

1. process\_venue.sh - which is responsible for indexing and mapping.
2. venue\_display.php - Responsible for displaying the data when click on search button.

As stated previous my data is coming this way,  
Array  
(  
[id] =\> 178014  
[title] =\> Test  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 9,  
[catid] =\> 111,,  
[subcatid] =\> -1,,  
[created] =\> 1999-11-30 00:00:00  
[created\_by] =\> 78  
[modified] =\> 2013-04-24 01:41:59  
[modified\_by] =\> 173  
[cityid] =\> 28  
[latitude] =\> 45.49927930  
[longitude] =\> 9.12125800  
)

Array  
(  
[id] =\> 664009  
[title] =\> Test,  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 9,  
[catid] =\> 96,  
[subcatid] =\> 219,  
[created] =\> 2010-06-28 18:55:51  
[created\_by] =\> 204  
[modified] =\> 0000-00-00 00:00:00  
[modified\_by] =\> 0  
[cityid] =\> 80  
[latitude] =\> 35.66904600  
[longitude] =\> 139.70728060  
)

Thanks,  
Vallabh

On Wednesday, November 6, 2013 4:02:06 PM UTC+5:30, David Pilato wrote:  
Could you illustrate your example by gisting a full curl recreation?

I think reading your code that you are not using geo\_points in your mapping but I may be wrong.

A curl recreation should help to understand what you are doing and how.

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

Le 6 nov. 2013 à 11:20, [val...@wcities.com](mailto:val...@wcities.com) a écrit :

Thanks for the reply.  
Basically, i wanted to search by latitude and longitude.

I am getting this data,  
Array  
(  
[id] =\> 785629  
[title] =\> test  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 1,  
[catid] =\> 2,  
[subcatid] =\> -1,  
[created] =\> 2013-01-07 10:47:48  
[created\_by] =\> 119  
[modified] =\> 2013-04-24 01:41:59  
[modified\_by] =\> 173  
[cityid] =\> 5887  
[latitude] =\> 19.18667600  
[longitude] =\> 72.83363880  
)  
If i have selected city London (51.50015200,-0.12623600), then i should be getting nearest result from london itself.

Below is my code,  
$result = $es-\>search(array(  
"query" =\> array(  
"dis\_max" =\> array(  
"queries" =\> array(  
0 =\> array(  
"field" =\> array(  
"title" =\> $search //search value  
)  
)  
)  
)  
),  
"from" =\> 0,  
"size" =\> 100000  
)  
);

On Wednesday, November 6, 2013 12:09:23 PM UTC+5:30, David Pilato wrote:  
Are you looking for this? [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#\_geo\_distance\_sorting](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_geo_distance_sorting)

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

Le 6 nov. 2013 à 07:10, [val...@wcities.com](mailto:val...@wcities.com) a écrit :

Dear All,

I want to develop functionality to display results sorted by nearest city using latitude and longitude.

For ex,  
I have default city selected lets says, London whose latitude and longitude is 51.50015200,-0.12623600  
So i want to display result from London sorted by nearest city.  
All result is having latitude and longitude.

But i am unable to develop in elastic search.

Any suggestions will be highly appreciated.

## Thanks, Vallabh

## 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). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

## 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). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

- process\_venue.sh, 1.2 KB
- venue\_display.php, 2.4 KB

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vallabh](https://avatars.discourse-cdn.com/v4/letter/v/e8c25b/32.png) [@vallabh](https://discuss.elastic.co/u/vallabh)\
**Post date:** [November 6, 2013, 2:35pm UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/7 "2013-11-06T14:35:01Z")

</div>

Hey David,

Thanks for the quick response and suggestion.  
But still unable to understand why results are not displaying.  
I have attached my 2 files named process\_venue.sh and venue\_display.php,  
Is it possible for you to tell me where i am actually wrong ?  
I have also changed my fields to lan and lon

Array  
(  
[id] =\> 785629  
[title] =\> test  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 1,  
[catid] =\> 2,  
[subcatid] =\> -1,  
[created] =\> 2013-01-07 10:47:48  
[created\_by] =\> 119  
[modified] =\> 2013-04-24 01:41:59  
[modified\_by] =\> 173  
[cityid] =\> 5887  
[lat] =\> 19.18667600  
[lon] =\> 72.83363880  
)

Thanks,  
Vallabh

On Wednesday, November 6, 2013 4:44:24 PM UTC+5:30, David Pilato wrote:

> So you answered yourself to your questions I guess. If you want to use geo  
> distance sorting then you have to use geo\_points in your mapping and create  
> documents with proper geo fields.
> 
> This should help as well:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> 6 novembre 2013 at 12:04:33, [val...@wcities.com](mailto:val...@wcities.com) \<javascript:\> (  
> [val...@wcities.com](mailto:val...@wcities.com) \<javascript:\>) a écrit:
> 
> Thanks for the quick suggestions,
> 
> I am new in Elasticsearch and yes i am not using geo\_points in mapping.
> 
> I have attached 2 files named,
> 
> 1. process\_venue.sh - which is responsible for indexing and mapping.
> 2. venue\_display.php - Responsible for displaying the data when click on  
> search button.
> 
> As stated previous my data is coming this way,
> 
> Array  
> (  
> [id] =\> 178014  
> [title] =\> Test  
> [alias] =\> test  
> [state] =\> 1  
> [sectionid] =\> 9,  
> [catid] =\> 111,,  
> [subcatid] =\> -1,,  
> [created] =\> 1999-11-30 00:00:00  
> [created\_by] =\> 78  
> [modified] =\> 2013-04-24 01:41:59  
> [modified\_by] =\> 173  
> [cityid] =\> 28  
> [latitude] =\> 45.49927930  
> [longitude] =\> 9.12125800  
> )
> 
> Array  
> (  
> [id] =\> 664009  
> [title] =\> Test,  
> [alias] =\> test  
> [state] =\> 1  
> [sectionid] =\> 9,  
> [catid] =\> 96,  
> [subcatid] =\> 219,  
> [created] =\> 2010-06-28 18:55:51  
> [created\_by] =\> 204  
> [modified] =\> 0000-00-00 00:00:00  
> [modified\_by] =\> 0  
> [cityid] =\> 80  
> [latitude] =\> 35.66904600  
> [longitude] =\> 139.70728060  
> )
> 
> Thanks,  
> Vallabh
> 
> On Wednesday, November 6, 2013 4:02:06 PM UTC+5:30, David Pilato wrote:
> 
> > Could you illustrate your example by gisting a full curl recreation?
> > 
> > I think reading your code that you are not using geo\_points in your  
> > mapping but I may be wrong.
> > 
> > A curl recreation should help to understand what you are doing and how.
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 6 nov. 2013 à 11:20, [val...@wcities.com](mailto:val...@wcities.com) a écrit :
> > 
> > Thanks for the reply.  
> > Basically, i wanted to search by latitude and longitude.
> > 
> > I am getting this data,
> > 
> > Array  
> > (  
> > [id] =\> 785629  
> > [title] =\> test  
> > [alias] =\> test  
> > [state] =\> 1  
> > [sectionid] =\> 1,  
> > [catid] =\> 2,  
> > [subcatid] =\> -1,  
> > [created] =\> 2013-01-07 10:47:48  
> > [created\_by] =\> 119  
> > [modified] =\> 2013-04-24 01:41:59  
> > [modified\_by] =\> 173  
> > [cityid] =\> 5887  
> > [latitude] =\> 19.18667600  
> > [longitude] =\> 72.83363880  
> > )
> > 
> > If i have selected city London (51.50015200,-0.12623600), then i should  
> > be getting nearest result from london itself.
> > 
> > Below is my code,  
> > $result = $es-\>search(array(  
> > "query" =\> array(  
> > "dis\_max" =\> array(  
> > "queries" =\> array(  
> > 0 =\> array(  
> > "field" =\> array(  
> > "title" =\> $search //search value  
> > )  
> > )  
> > )  
> > )  
> > ),  
> > "from" =\> 0,  
> > "size" =\> 100000  
> > )  
> > );
> > 
> > On Wednesday, November 6, 2013 12:09:23 PM UTC+5:30, David Pilato wrote:
> > 
> > > Are you looking for this?  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_geo_distance_sorting)
> > > 
> > > --  
> > > David 😉  
> > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > 
> > > Le 6 nov. 2013 à 07:10, [val...@wcities.com](mailto:val...@wcities.com) a écrit :
> > > 
> > > Dear All,
> > > 
> > > I want to develop functionality to display results sorted by nearest  
> > > city using latitude and longitude.
> > > 
> > > For ex,  
> > > I have default city selected lets says, London whose latitude and  
> > > longitude is 51.50015200,-0.12623600  
> > > So i want to display result from London sorted by nearest city.  
> > > All result is having latitude and longitude.
> > > 
> > > But i am unable to develop in Elasticsearch.
> > > 
> > > Any suggestions will be highly appreciated.
> > > 
> > > ## Thanks, Vallabh
> > > 
> > > 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).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > 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:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> * * *
> 
> - process\_venue.sh, 1.2 KB
> - venue\_display.php, 2.4 KB

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [November 6, 2013, 2:59pm UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/8 "2013-11-06T14:59:00Z")

</div>

I have no idea as your curl recreation does not show how your documents are formed.  
Please don't attach files to threads but GIST your examples: [http://www.elasticsearch.org/help](http://www.elasticsearch.org/help)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

6 novembre 2013 at 15:35:05, Vallabh Bothre ([vallabh.bothre@gmail.com](mailto:vallabh.bothre@gmail.com)) a écrit:

Hey David,

Thanks for the quick response and suggestion.  
But still unable to understand why results are not displaying.  
I have attached my 2 files named process\_venue.sh and venue\_display.php,  
Is it possible for you to tell me where i am actually wrong ?  
I have also changed my fields to lan and lon  
Array  
(  
[id] =\> 785629  
[title] =\> test  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 1,  
[catid] =\> 2,  
[subcatid] =\> -1,  
[created] =\> 2013-01-07 10:47:48  
[created\_by] =\> 119  
[modified] =\> 2013-04-24 01:41:59  
[modified\_by] =\> 173  
[cityid] =\> 5887  
[lat] =\> 19.18667600  
[lon] =\> 72.83363880  
)

Thanks,  
Vallabh

On Wednesday, November 6, 2013 4:44:24 PM UTC+5:30, David Pilato wrote:  
So you answered yourself to your questions I guess. If you want to use geo distance sorting then you have to use geo\_points in your mapping and create documents with proper geo fields.

This should help as well: [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

6 novembre 2013 at 12:04:33, [val...@wcities.com](mailto:val...@wcities.com) ([val...@wcities.com](mailto:val...@wcities.com)) a écrit:

Thanks for the quick suggestions,

I am new in elastic search and yes i am not using geo\_points in mapping.

I have attached 2 files named,

1. process\_venue.sh - which is responsible for indexing and mapping.
2. venue\_display.php - Responsible for displaying the data when click on search button.

As stated previous my data is coming this way,  
Array  
(  
[id] =\> 178014  
[title] =\> Test  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 9,  
[catid] =\> 111,,  
[subcatid] =\> -1,,  
[created] =\> 1999-11-30 00:00:00  
[created\_by] =\> 78  
[modified] =\> 2013-04-24 01:41:59  
[modified\_by] =\> 173  
[cityid] =\> 28  
[latitude] =\> 45.49927930  
[longitude] =\> 9.12125800  
)

Array  
(  
[id] =\> 664009  
[title] =\> Test,  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 9,  
[catid] =\> 96,  
[subcatid] =\> 219,  
[created] =\> 2010-06-28 18:55:51  
[created\_by] =\> 204  
[modified] =\> 0000-00-00 00:00:00  
[modified\_by] =\> 0  
[cityid] =\> 80  
[latitude] =\> 35.66904600  
[longitude] =\> 139.70728060  
)

Thanks,  
Vallabh

On Wednesday, November 6, 2013 4:02:06 PM UTC+5:30, David Pilato wrote:  
Could you illustrate your example by gisting a full curl recreation?

I think reading your code that you are not using geo\_points in your mapping but I may be wrong.

A curl recreation should help to understand what you are doing and how.

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

Le 6 nov. 2013 à 11:20, [val...@wcities.com](mailto:val...@wcities.com) a écrit :

Thanks for the reply.  
Basically, i wanted to search by latitude and longitude.

I am getting this data,  
Array  
(  
[id] =\> 785629  
[title] =\> test  
[alias] =\> test  
[state] =\> 1  
[sectionid] =\> 1,  
[catid] =\> 2,  
[subcatid] =\> -1,  
[created] =\> 2013-01-07 10:47:48  
[created\_by] =\> 119  
[modified] =\> 2013-04-24 01:41:59  
[modified\_by] =\> 173  
[cityid] =\> 5887  
[latitude] =\> 19.18667600  
[longitude] =\> 72.83363880  
)  
If i have selected city London (51.50015200,-0.12623600), then i should be getting nearest result from london itself.

Below is my code,  
$result = $es-\>search(array(  
"query" =\> array(  
"dis\_max" =\> array(  
"queries" =\> array(  
0 =\> array(  
"field" =\> array(  
"title" =\> $search //search value  
)  
)  
)  
)  
),  
"from" =\> 0,  
"size" =\> 100000  
)  
);

On Wednesday, November 6, 2013 12:09:23 PM UTC+5:30, David Pilato wrote:  
Are you looking for this? [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#\_geo\_distance\_sorting](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_geo_distance_sorting)

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

Le 6 nov. 2013 à 07:10, [val...@wcities.com](mailto:val...@wcities.com) a écrit :

Dear All,

I want to develop functionality to display results sorted by nearest city using latitude and longitude.

For ex,  
I have default city selected lets says, London whose latitude and longitude is 51.50015200,-0.12623600  
So i want to display result from London sorted by nearest city.  
All result is having latitude and longitude.

But i am unable to develop in elastic search.

Any suggestions will be highly appreciated.

## Thanks, Vallabh

## 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). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

## 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). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

- process\_venue.sh, 1.2 KB
- venue\_display.php, 2.4 KB  
--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
- process\_venue.sh, 1.3 KB
- venue\_display.php, 3 KB

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![vallabh](https://avatars.discourse-cdn.com/v4/letter/v/e8c25b/32.png) [@vallabh](https://discuss.elastic.co/u/vallabh)\
**Post date:** [November 7, 2013, 4:41am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/9 "2013-11-07T04:41:04Z")

</div>

Thanks for helping me David!  
Vallabh

On Wednesday, November 6, 2013 8:29:00 PM UTC+5:30, David Pilato wrote:

> I have no idea as your curl recreation does not show how your documents  
> are formed.  
> Please don't attach files to threads but GIST your examples:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> 6 novembre 2013 at 15:35:05, Vallabh Bothre ([vallabh...@gmail.com](mailto:vallabh...@gmail.com)\<javascript:\>)  
> a écrit:
> 
> Hey David,
> 
> Thanks for the quick response and suggestion.  
> But still unable to understand why results are not displaying.  
> I have attached my 2 files named process\_venue.sh and venue\_display.php,  
> Is it possible for you to tell me where i am actually wrong ?  
> I have also changed my fields to lan and lon
> 
> Array  
> (  
> [id] =\> 785629  
> [title] =\> test  
> [alias] =\> test  
> [state] =\> 1  
> [sectionid] =\> 1,  
> [catid] =\> 2,  
> [subcatid] =\> -1,  
> [created] =\> 2013-01-07 10:47:48  
> [created\_by] =\> 119  
> [modified] =\> 2013-04-24 01:41:59  
> [modified\_by] =\> 173  
> [cityid] =\> 5887  
> [lat] =\> 19.18667600  
> [lon] =\> 72.83363880  
> )
> 
> Thanks,  
> Vallabh
> 
> On Wednesday, November 6, 2013 4:44:24 PM UTC+5:30, David Pilato wrote:
> 
> > So you answered yourself to your questions I guess. If you want to use  
> > geo distance sorting then you have to use geo\_points in your mapping and  
> > create documents with proper geo fields.
> > 
> > This should help as well:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-point-type.html)
> > 
> > ```
> > -- 
> > 
> > ```
> > 
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> > 
> > 6 novembre 2013 at 12:04:33, [val...@wcities.com](mailto:val...@wcities.com) ([val...@wcities.com](mailto:val...@wcities.com)) a  
> > écrit:
> > 
> > Thanks for the quick suggestions,
> > 
> > I am new in Elasticsearch and yes i am not using geo\_points in mapping.
> > 
> > I have attached 2 files named,
> > 
> > 1. process\_venue.sh - which is responsible for indexing and mapping.
> > 2. venue\_display.php - Responsible for displaying the data when click on  
> > search button.
> > 
> > As stated previous my data is coming this way,
> > 
> > Array  
> > (  
> > [id] =\> 178014  
> > [title] =\> Test  
> > [alias] =\> test  
> > [state] =\> 1  
> > [sectionid] =\> 9,  
> > [catid] =\> 111,,  
> > [subcatid] =\> -1,,  
> > [created] =\> 1999-11-30 00:00:00  
> > [created\_by] =\> 78  
> > [modified] =\> 2013-04-24 01:41:59  
> > [modified\_by] =\> 173  
> > [cityid] =\> 28  
> > [latitude] =\> 45.49927930  
> > [longitude] =\> 9.12125800  
> > )
> > 
> > Array  
> > (  
> > [id] =\> 664009  
> > [title] =\> Test,  
> > [alias] =\> test  
> > [state] =\> 1  
> > [sectionid] =\> 9,  
> > [catid] =\> 96,  
> > [subcatid] =\> 219,  
> > [created] =\> 2010-06-28 18:55:51  
> > [created\_by] =\> 204  
> > [modified] =\> 0000-00-00 00:00:00  
> > [modified\_by] =\> 0  
> > [cityid] =\> 80  
> > [latitude] =\> 35.66904600  
> > [longitude] =\> 139.70728060  
> > )
> > 
> > Thanks,  
> > Vallabh
> > 
> > On Wednesday, November 6, 2013 4:02:06 PM UTC+5:30, David Pilato wrote:
> > 
> > > Could you illustrate your example by gisting a full curl recreation?
> > > 
> > > I think reading your code that you are not using geo\_points in your  
> > > mapping but I may be wrong.
> > > 
> > > A curl recreation should help to understand what you are doing and how.
> > > 
> > > --  
> > > David 😉  
> > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > 
> > > Le 6 nov. 2013 à 11:20, [val...@wcities.com](mailto:val...@wcities.com) a écrit :
> > > 
> > > Thanks for the reply.  
> > > Basically, i wanted to search by latitude and longitude.
> > > 
> > > I am getting this data,
> > > 
> > > Array  
> > > (  
> > > [id] =\> 785629  
> > > [title] =\> test  
> > > [alias] =\> test  
> > > [state] =\> 1  
> > > [sectionid] =\> 1,  
> > > [catid] =\> 2,  
> > > [subcatid] =\> -1,  
> > > [created] =\> 2013-01-07 10:47:48  
> > > [created\_by] =\> 119  
> > > [modified] =\> 2013-04-24 01:41:59  
> > > [modified\_by] =\> 173  
> > > [cityid] =\> 5887  
> > > [latitude] =\> 19.18667600  
> > > [longitude] =\> 72.83363880  
> > > )
> > > 
> > > If i have selected city London (51.50015200,-0.12623600), then i should  
> > > be getting nearest result from london itself.
> > > 
> > > Below is my code,  
> > > $result = $es-\>search(array(  
> > > "query" =\> array(  
> > > "dis\_max" =\> array(  
> > > "queries" =\> array(  
> > > 0 =\> array(  
> > > "field" =\> array(  
> > > "title" =\> $search //search value  
> > > )  
> > > )  
> > > )  
> > > )  
> > > ),  
> > > "from" =\> 0,  
> > > "size" =\> 100000  
> > > )  
> > > );
> > > 
> > > On Wednesday, November 6, 2013 12:09:23 PM UTC+5:30, David Pilato wrote:
> > > 
> > > > Are you looking for this?  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_geo_distance_sorting)
> > > > 
> > > > --  
> > > > David 😉  
> > > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > > 
> > > > Le 6 nov. 2013 à 07:10, [val...@wcities.com](mailto:val...@wcities.com) a écrit :
> > > > 
> > > > Dear All,
> > > > 
> > > > I want to develop functionality to display results sorted by nearest  
> > > > city using latitude and longitude.
> > > > 
> > > > For ex,  
> > > > I have default city selected lets says, London whose latitude and  
> > > > longitude is 51.50015200,-0.12623600  
> > > > So i want to display result from London sorted by nearest city.  
> > > > All result is having latitude and longitude.
> > > > 
> > > > But i am unable to develop in Elasticsearch.
> > > > 
> > > > Any suggestions will be highly appreciated.
> > > > 
> > > > ## Thanks, Vallabh
> > > > 
> > > > 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).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > 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).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > 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).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > * * *
> > 
> > - process\_venue.sh, 1.2 KB
> > 
> > - venue\_display.php, 2.4 KB
> 
> * * *
> 
> - process\_venue.sh, 1.3 KB
> - venue\_display.php, 3 KB

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:08am UTC](https://discuss.elastic.co/t/search-result-sorted-by-nearest-city-using-longitude-and-latitude/14283/10 "2017-07-06T02:08:25Z")

</div>


