You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Count APIedit
The count API allows to easily execute a query and get the number of matches for that query. It can be executed across one or more indices and across one or more types. The query can be provided using the Query DSL.
import static org.elasticsearch.index.query.xcontent.FilterBuilders.*; import static org.elasticsearch.index.query.xcontent.QueryBuilders.*; CountResponse response = client.prepareCount("test") .setQuery(termQuery("_type", "type1")) .execute() .actionGet();
For more information on the count operation, check out the REST count docs.