1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- [[cat-count]]
- === cat count API
- ++++
- <titleabbrev>cat count</titleabbrev>
- ++++
- Provides quick access to a document count for a data stream, an index, or an
- entire cluster.
- NOTE: The document count only includes live documents, not deleted documents
- which have not yet been removed by the merge process.
- [[cat-count-api-request]]
- ==== {api-request-title}
- `GET /_cat/count/<target>`
- `GET /_cat/count`
- [[cat-count-api-path-params]]
- ==== {api-path-parms-title}
- `<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
- `_all` or `*`.
- [[cat-count-api-query-params]]
- ==== {api-query-parms-title}
- include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
- include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
- include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
- include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
- include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
- [[cat-count-api-example]]
- ==== {api-examples-title}
- [[cat-count-api-example-ind]]
- ===== Example with an individual data stream or index
- The following `count` API request retrieves the document count for the
- `my-index-000001` data stream or index.
- [source,console,id=cat-count-individual-example]
- --------------------------------------------------
- GET /_cat/count/my-index-000001?v
- --------------------------------------------------
- // TEST[setup:my_index_big]
- The API returns the following response:
- [source,txt]
- --------------------------------------------------
- epoch timestamp count
- 1475868259 15:24:20 120
- --------------------------------------------------
- // TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
- [[cat-count-api-example-all]]
- ===== Example with all data streams and indices in a cluster
- The following `count` API request retrieves the document count for all data
- streams and indices in the cluster.
- [source,console,id=cat-count-all-example]
- --------------------------------------------------
- GET /_cat/count?v
- --------------------------------------------------
- // TEST[setup:my_index_big]
- // TEST[s/^/POST test\/_doc\?refresh\n{"test": "test"}\n/]
- The API returns the following response:
- [source,txt]
- --------------------------------------------------
- epoch timestamp count
- 1475868259 15:24:20 121
- --------------------------------------------------
- // TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
|