WARNING: The 2.x versions of Elasticsearch have passed their EOL dates. If you are running a 2.x version, we strongly advise you to upgrade.
This documentation is no longer maintained and may be removed. For the latest information, see the current Elasticsearch documentation.
Empty Searchedit
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.