Part Speaking elastic search (referred es) commonly used search api, but sometimes we do not need the original document data to meet the conditions, but need to return the number of documents in line with the conditions, similar to the mysql select count (*) query bar number, a count query api es in the endpoint is "_count", the following example:
Node that is returned count represents the number of qualifying matches. "_Count" Support for multiple simultaneous queries index number of qualifying matches:
Previous: Elastic Search's Search API (Query DSL), field type queries, complex queries
References: Es official document https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html