Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
HowToSearch.md 4.20 KiB

How to search with Elasticsearch DSL

In this chapter we will take a look how to perform a search via objective way with Elasticsearch DSL. Well, the good news is that is very simple. That's why we created this library ;).

To start a search you have to create a Search object.

$search = new Search();

We won't include namespaces in any examples. Don't worry all class's names are unique, so any IDE editor should autocomplete and include it for you ;).

So, when we have a Search object we can start add something to it. Usually you will add Query, Filter and Aggregation.

More info how create queries, filters and aggregations objects.

Form a Query

Lets take a simple query example with MatchAllQuery.

$matchAllQuery = new MatchAllQuery();