Elastic Search of Count API (get the number of records that meet the criteria)

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:


books Previous: Elastic Search's Search API (Query DSL), field type queries, complex queries

books Next: Elastic Search of the Source Filtering (filtering results "_source" which fields to display original text)

books References: Es official document https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html

Published 202 original articles · won praise 571 · Views 1.47 million +

Guess you like

Origin blog.csdn.net/fanrenxiang/article/details/86489094