cat count API
editcat count API
editProvides quick access to a document count for a data stream, an index, or an entire cluster.
The document count only includes live documents, not deleted documents which have not yet been removed by the merge process.
Prerequisites
edit-
If the Elasticsearch security features are enabled, you must have the
readindex privilege for any data stream, index, or index alias you retrieve.
Path parameters
edit-
<target> -
(Optional, string) Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (
*) are supported.To target all data streams and indices in a cluster, omit this parameter or use
_allor*.
Query parameters
edit-
format - (Optional, string) Short version of the HTTP accept header. Valid values include JSON, YAML, etc.
-
h - (Optional, string) Comma-separated list of column names to display.
-
help -
(Optional, Boolean) If
true, the response includes help information. Defaults tofalse. -
s - (Optional, string) Comma-separated list of column names or column aliases used to sort the response.
-
v -
(Optional, Boolean) If
true, the response includes column headings. Defaults tofalse.
Examples
editExample with an individual data stream or index
editThe following count API request retrieves the document count for the
my-index-000001 data stream or index.
GET /_cat/count/my-index-000001?v=true
The API returns the following response:
epoch timestamp count 1475868259 15:24:20 120
Example with all data streams and indices in a cluster
editThe following count API request retrieves the document count for all data
streams and indices in the cluster.
GET /_cat/count?v=true
The API returns the following response:
epoch timestamp count 1475868259 15:24:20 121