Geo_distance_range is obsolete?


In old ES we had the function "geo_distance_range" that allows to filter everything between, let's say by example, 20k and 50km.

When I look at the documentation, they propose to use geo distance aggregations:

But, how can I use the aggregation to create such filter, I have search for an example, try during hours to achieve such query... no way !

Here is an example of query:

"query": {
"bool" : {
"must" : {
"match_all" : {}
"filter" : {
"geo_distance" : {
"distance" : "50km",
"geoLocations" : [{{longitude}}, {{latitude}}]

If someone has an idea to help ?

Thanks a lot :wink:

Cannot you use a must_not clause for the inner ring to remove those hits?

1 Like

Thanks @Ignacio_Vera,

This way it work :wink:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.