-
Mantas Varatiejus authored
Also removed unused imports
Mantas Varatiejus authoredAlso removed unused imports
Code owners
Filter
WARNING: Filters are deprecated since 1.1 and will be removed in 2.0. Elasticsearch from 2.0 casts queries the same way as filters, so there is no reason to have both. More information in the elasticsearch docs
Objective filter builder represents all available Elasticsearch filters.
To form a filtered query you have to create Search
object. See below an example of match all filter usage.
$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:
//$queryArray content
'query' => [
'filtered' => [
'filter' => [
'match_all' => \stdClass(),
]
]
]
For more information how to combine search queries take a look at How to search chapter.