Empty Search

edit

Let’s start with the simplest form of the search API, the empty search, which returns all documents in all indices:

GET /_search
{} 

This is an empty request body.

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.