From f8c742ae826306c8d2c0f76933359f122ce456c0 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Fri, 3 Jul 2015 14:14:33 +0300 Subject: [PATCH] Add range query doc. --- docs/Query/Range.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/Query/Range.md diff --git a/docs/Query/Range.md b/docs/Query/Range.md new file mode 100644 index 0000000..3e90f0b --- /dev/null +++ b/docs/Query/Range.md @@ -0,0 +1,41 @@ +# Range Query + +> More info about range query is in the [official elasticsearch docs][1] + +Matches documents with fields that have terms within a certain range. + +## Simple example + +```JSON +{ + { + "range" : { + "age" : { + "gte" : 10, + "lte" : 20, + "boost" : 2.0 + } + } + } +} +``` + +In DSL: + +```php +$rangeQuery = new RangeQuery( + 'age', + [ + 'gte' => 10, + 'lte' => 20, + 'boost' => 2.0, + ] +); + +$search = new Search(); +$search->addQuery($rangeQuery); + +$queryArray = $search->toArray(); +``` + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html -- GitLab