Skip to content
Snippets Groups Projects
user avatar
Aivaras Gotovskis authored
c3bab416
History
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

Query

Objective query builder represents all available Elasticsearch queries.

To form a query you have to create Search object. See below an example of match all query usage.

$search = new Search();
$matchAllQuery = new MatchAllQuery();
$search->addQuery($matchAllQuery);
$queryArray = $search->toArray();

Query 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' =>
    [
      'match_all' => \stdClass(),
    ]

For more information how to combine search queries take a look at How to search chapter.

Queries: