2013-11-14 20:14:39 -05:00
|
|
|
[[cat-count]]
|
2019-08-13 08:35:08 -04:00
|
|
|
=== cat count API
|
|
|
|
++++
|
|
|
|
<titleabbrev>cat count</titleabbrev>
|
|
|
|
++++
|
2013-11-14 20:14:39 -05:00
|
|
|
|
2020-06-30 15:52:48 -04:00
|
|
|
Provides quick access to a document count for a data stream, an index, or an
|
|
|
|
entire cluster.
|
2019-08-06 08:36:22 -04:00
|
|
|
|
|
|
|
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}
|
|
|
|
|
2020-06-30 15:52:48 -04:00
|
|
|
`GET /_cat/count/<target>`
|
2019-08-06 08:36:22 -04:00
|
|
|
|
2019-10-10 09:48:40 -04:00
|
|
|
`GET /_cat/count`
|
|
|
|
|
2019-08-06 08:36:22 -04:00
|
|
|
|
|
|
|
[[cat-count-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
2020-06-30 15:52:48 -04:00
|
|
|
`<target>`::
|
|
|
|
(Optional, string)
|
2020-06-30 15:55:37 -04:00
|
|
|
Comma-separated list of data streams, indices, and index aliases used to limit
|
|
|
|
the request. Wildcard expressions (`*`) are supported.
|
2020-06-30 15:52:48 -04:00
|
|
|
+
|
|
|
|
To target all data streams and indices in a cluster, omit this parameter or use
|
|
|
|
`_all` or `*`.
|
2019-08-06 08:36:22 -04:00
|
|
|
|
|
|
|
[[cat-count-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
|
2019-08-06 08:36:22 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
|
2019-08-06 08:36:22 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
|
2019-08-06 08:36:22 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
|
2019-08-06 08:36:22 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
|
2019-08-06 08:36:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[cat-count-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
[[cat-count-api-example-ind]]
|
2020-06-30 15:52:48 -04:00
|
|
|
===== Example with an individual data stream or index
|
2019-08-06 08:36:22 -04:00
|
|
|
|
2020-06-30 15:52:48 -04:00
|
|
|
The following `count` API request retrieves the document count for the
|
|
|
|
`twitter` data stream or index.
|
2013-11-14 20:14:39 -05:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2013-11-14 20:14:39 -05:00
|
|
|
--------------------------------------------------
|
2019-08-06 08:36:22 -04:00
|
|
|
GET /_cat/count/twitter?v
|
2016-10-07 16:28:49 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:big_twitter]
|
|
|
|
|
2019-08-06 08:36:22 -04:00
|
|
|
|
|
|
|
The API returns the following response:
|
2016-10-07 16:28:49 -04:00
|
|
|
|
2016-10-25 10:56:30 -04:00
|
|
|
[source,txt]
|
2016-10-07 16:28:49 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
epoch timestamp count
|
2019-08-06 08:36:22 -04:00
|
|
|
1475868259 15:24:20 120
|
2016-10-07 16:28:49 -04:00
|
|
|
--------------------------------------------------
|
2019-08-06 08:36:22 -04:00
|
|
|
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
|
|
|
|
|
|
|
|
[[cat-count-api-example-all]]
|
2020-06-30 15:52:48 -04:00
|
|
|
===== Example with all data streams and indices in a cluster
|
2016-03-01 07:39:54 -05:00
|
|
|
|
2020-06-30 15:52:48 -04:00
|
|
|
The following `count` API request retrieves the document count for all data
|
|
|
|
streams and indices in the cluster.
|
2016-03-01 07:39:54 -05:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2013-11-14 20:14:39 -05:00
|
|
|
--------------------------------------------------
|
2019-08-06 08:36:22 -04:00
|
|
|
GET /_cat/count?v
|
2016-10-07 16:28:49 -04:00
|
|
|
--------------------------------------------------
|
2019-08-06 08:36:22 -04:00
|
|
|
// TEST[setup:big_twitter]
|
|
|
|
// TEST[s/^/POST test\/test\?refresh\n{"test": "test"}\n/]
|
|
|
|
|
|
|
|
The API returns the following response:
|
2016-10-07 16:28:49 -04:00
|
|
|
|
2016-10-25 10:56:30 -04:00
|
|
|
[source,txt]
|
2016-10-07 16:28:49 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
epoch timestamp count
|
2019-08-06 08:36:22 -04:00
|
|
|
1475868259 15:24:20 121
|
2016-10-07 16:28:49 -04:00
|
|
|
--------------------------------------------------
|
2019-06-10 09:33:32 -04:00
|
|
|
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
|