Geospatial proximity search within a certain radius sorted by distance

Hi,

I started playing around today with Elasticsearch. I indexed a couple of
documents that look like this :

{
"location": {
"name": "Montreal",
"location": {"lat": 45.50884, "lon": -73.58781}
}
}

and then I know that I can do something like this to get the locations that
are nearest first

{
"query" : {
"match_all" : {}
},
"sort" : [{
"_geo_distance": {
"location": {
"lat": 45.5247,
"lon": -73.5894
},
"order": "asc",
"unit": "km"
}
}]
}'

but how can I also specify that I also only want the locations that are
within a given distance/radius?

Hi,

I'm not an expert - far from this. But I found this on the docs. Maybe
it's what you want, isn't it?

Regards,

Em quarta-feira, 11 de julho de 2012 23h09min33s UTC-3, Patrick Paul-Hus
escreveu:

Hi,

I started playing around today with Elasticsearch. I indexed a couple of
documents that look like this :

{
"location": {
"name": "Montreal",
"location": {"lat": 45.50884, "lon": -73.58781}
}
}

and then I know that I can do something like this to get the locations
that are nearest first

{
"query" : {
"match_all" : {}
},
"sort" : [{
"_geo_distance": {
"location": {
"lat": 45.5247,
"lon": -73.5894
},
"order": "asc",
"unit": "km"
}
}]
}'

but how can I also specify that I also only want the locations that are
within a given distance/radius?