From 69a91fce557800a2b8d1a042b5ff05a0f64f2fe8 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Tue, 7 Jul 2015 12:48:00 +0300 Subject: [PATCH] Add geo distance range filter doc. --- docs/Filter/GeoDistanceRange.md | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 docs/Filter/GeoDistanceRange.md diff --git a/docs/Filter/GeoDistanceRange.md b/docs/Filter/GeoDistanceRange.md new file mode 100644 index 0000000..ccb692c --- /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 + -- GitLab