- Java Transport Client (deprecated): other versions:
- Preface
- Maven Repository
- Deploying in JBoss EAP6 module
- Client
- Document APIs
- Search API
- Count API
- Aggregations
- Percolate API
- Query DSL
- Indexed Scripts API
IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Count API
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Count API
editThe count API allows one 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.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.
Was this helpful?
Thank you for your feedback.