From e921b5d5e710abf7707deea845cda2663b569fc1 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io> Date: Tue, 7 Jul 2015 11:14:36 +0300 Subject: [PATCH] Add Filter index. --- docs/Filter/index.md | 63 ++++++++++++++++++++++++++++++++++++++++++++ docs/index.md | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 docs/Filter/index.md diff --git a/docs/Filter/index.md b/docs/Filter/index.md new file mode 100644 index 0000000..284c089 --- /dev/null +++ b/docs/Filter/index.md @@ -0,0 +1,63 @@ +# Query + +Objective filter builder represents all available [Elasticsearch filters][1]. + +To form a filtered query you have to create `Search` object. See below an example of match all filter usage. + +```php +$search = new Search(); +$matchAllFilter = new MatchAllFilter(); +$search->addFilter($matchAllFilter); +$queryArray = $search->toArray(); +``` + +Filters handles are necessary little things like where to put `\stdClass` and where to simple array. So by using DSL builder you can be always sure that it will form a correct query. + +Here's `$queryArray` var_dump: + +```php +//$queryArray content +'query' => [ + 'filtered' => [ + 'filter' => [ + 'match_all' => \stdClass(), + ] + ] + ] +``` + +For more information how to combine search queries take a look at [How to search](../HowTo/HowToSearch.md) chapter. + + +## Filters: + - [And](And.md) + - [Bool](Bool.md) + - [Exists](Exists.md) + - [GeoBoundingBox](GeoBoundingBox.md) + - [GeoDistance](GeoDistance.md) + - [GeoDistanceRange](GeoDistanceRange.md) + - [GeoPolygon](GeoPolygon.md) + - [GeoShape](GeoShape.md) + - [GeohashCell](GeohashCell.md) + - [HasChild](HasChild.md) + - [HasParent](HasParent.md) + - [Ids](Ids.md) + - [Indices](Indices.md) + - [Limit](Limit.md) + - [MatchAll](MatchAll.md) + - [Missing](Missing.md) + - [Nested](Nested.md) + - [Not](Not.md) + - [Or](Or.md) + - [Post](Post.md) + - [Prefix](Prefix.md) + - [Query](Query.md) + - [Range](Range.md) + - [Regexp](Regexp.md) + - [Script](Script.md) + - [Term](Term.md) + - [Terms](Terms.md) + - [Type](Type.md) + + +[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-filters.html diff --git a/docs/index.md b/docs/index.md index 0f73b6e..81b8256 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,7 +6,7 @@ Everything starts from the `Search` object. We recommend first to take a look at ### Topics: - [Build Queries](Query/index.md) -- [Build Filters] +- [Build Filters](Filter/index.md) - [Build Aggregations] ### How to -- GitLab