While Elasticsearch comes with many queries, you will use
just a few frequently. We discuss them in much greater
detail in Search in Depth but next we give you a quick introduction to
the most important queries.

The match_all query simply matches all documents. It is the default
query that is used if no query has been specified:

{ "match_all": {}}

This query is frequently used in combination with a filter—for instance, to
retrieve all emails in the inbox folder. All documents are considered to be
equally relevant, so they all receive a neutral _score of 1.

For exact-value searches, you probably want to use a filter clause instead of a
query, as a filter will be cached. We’ll see some filtering examples soon.

Unlike the query-string search that we showed in Search Lite, the match
query does not use a query syntax like +user_id:2 +tweet:search. It just
looks for the words that are specified. This means that it is safe to expose
to your users via a search field; you control what fields they can query, and
it is not prone to throwing syntax errors.

The exists and missing queries are used to find documents in which the
specified field either has one or more values (exists) or doesn’t have any
values (missing). It is similar in nature to IS_NULL (missing) and NOT
IS_NULL (exists) in SQL:

{
"exists": {
"field": "title"
}
}

These queries are frequently used to apply a condition only if a field is
present, and to apply a different condition if it is missing.