This information applies to version 1.x of Elasticsearch. For the
most up to date information, see the current version of the
Elasticsearch Reference.
Let’s start with the simplest form of the search
API, the empty search,
which returns all documents in all indices:
Just as with a query-string search, you can search on one, many, or _all
indices, and one, many, or all types:
GET /index_2014*/type1,type2/_search {}
And you can use the from
and size
parameters for pagination:
GET /_search { "from": 30, "size": 10 }
We present aggregations in depth in Aggregations, but for now, we’re going to focus just on the query.
Instead of the cryptic query-string approach, a request body search allows us to write queries by using the query domain-specific language, or query DSL.