diff --git a/docs/Filter/GeoDistanceRange.md b/docs/Filter/GeoDistanceRange.md new file mode 100644 index 0000000000000000000000000000000000000000..ccb692c0e7b95f42dc2b18de1ba08ccfbd921a83 --- /dev/null +++ b/docs/Filter/GeoDistanceRange.md @@ -0,0 +1,45 @@ +# Geo Distance Range Filter + +> More info about geo distance range filter is in the [official elasticsearch docs][1] + +Filters documents that exists within a range from a specific point. + +## Simple example + +```JSON +{ + "filtered" : { + "query" : { + "match_all" : {} + }, + "filter" : { + "geo_distance_range" : { + "from" : "200km", + "to" : "400km", + "pin.location" : { + "lat" : 40, + "lon" : -70 + } + } + } + } +} +``` + +And now the query via DSL: + +```php +$geoDistanceRangeFilter = new GeoDistanceRangeFilter( + 'pin.location', + ['from' => '200km', 'to' => '400km'], + ['lat' => 40, 'lon' => -70] +); + +$search = new Search(); +$search->addFilter($geoDistanceRangeFilter); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-range-filter.html +