From 397025a6a78b6028d515f39dfa84a3525b6ba863 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Tue, 7 Jul 2015 12:15:27 +0300 Subject: [PATCH] Add geo bounding box filter doc. --- docs/Filter/GeoBoundingBox.md | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 docs/Filter/GeoBoundingBox.md diff --git a/docs/Filter/GeoBoundingBox.md b/docs/Filter/GeoBoundingBox.md new file mode 100644 index 0000000..9a2e117 --- /dev/null +++ b/docs/Filter/GeoBoundingBox.md @@ -0,0 +1,50 @@ +# Geo Bounding Box Filter + +> More info about geo bounding box filter is in the [official elasticsearch docs][1] + +A filter allowing to filter hits based on a point location using a bounding box. + +## Simple example + +```JSON +{ + "filtered" : { + "query" : { + "match_all" : {} + }, + "filter" : { + "geo_bounding_box" : { + "pin.location" : { + "top_left" : { + "lat" : 40.73, + "lon" : -74.1 + }, + "bottom_right" : { + "lat" : 40.01, + "lon" : -71.12 + } + } + } + } + } +} +``` + +And now the query via DSL: + +```php +$geoBoundingBoxFilter = new GeoBoundingBoxFilter( + 'pin.location', + [ + ['lat' => 40.73, 'lon' => -74.1], + ['lat' => 40.01, 'lon' => -74.12], + ] +); + +$search = new Search(); +$search->addFilter($geoBoundingBoxFilter); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-filter.html -- GitLab