2013-11-15 09:14:39 +08:00
|
|
|
[[cat-count]]
|
2019-08-13 20:35:08 +08:00
|
|
|
=== cat count API
|
|
|
|
++++
|
|
|
|
<titleabbrev>cat count</titleabbrev>
|
|
|
|
++++
|
2013-11-15 09:14:39 +08:00
|
|
|
|
2019-08-06 20:36:22 +08:00
|
|
|
Provides quick access to a document count of individual indices or all indices
|
|
|
|
in a 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}
|
|
|
|
|
2019-08-23 22:57:20 +08:00
|
|
|
`GET /_cat/count/<index>`
|
2019-08-06 20:36:22 +08:00
|
|
|
|
2019-10-10 20:29:27 +08:00
|
|
|
`GET /_cat/count`
|
|
|
|
|
2019-08-06 20:36:22 +08:00
|
|
|
|
|
|
|
[[cat-count-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
|
|
|
|
|
|
|
|
|
|
|
|
[[cat-count-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=http-format]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-h]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=help]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-s]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-v]
|
|
|
|
|
|
|
|
|
|
|
|
[[cat-count-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
[[cat-count-api-example-ind]]
|
|
|
|
===== Example with an individual index
|
|
|
|
|
|
|
|
The following `count` API request retrieves the document count of a single
|
|
|
|
index, `twitter`.
|
2013-11-15 09:14:39 +08:00
|
|
|
|
2019-10-08 05:06:49 +08:00
|
|
|
[source,console,id=cat-count-individual-example]
|
2013-11-15 09:14:39 +08:00
|
|
|
--------------------------------------------------
|
2019-08-06 20:36:22 +08:00
|
|
|
GET /_cat/count/twitter?v
|
2016-10-08 04:28:49 +08:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:big_twitter]
|
|
|
|
|
2019-08-06 20:36:22 +08:00
|
|
|
|
|
|
|
The API returns the following response:
|
2016-10-08 04:28:49 +08:00
|
|
|
|
2016-10-25 22:56:30 +08:00
|
|
|
[source,txt]
|
2016-10-08 04:28:49 +08:00
|
|
|
--------------------------------------------------
|
|
|
|
epoch timestamp count
|
2019-08-06 20:36:22 +08:00
|
|
|
1475868259 15:24:20 120
|
2016-10-08 04:28:49 +08:00
|
|
|
--------------------------------------------------
|
2019-08-06 20:36:22 +08:00
|
|
|
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
|
|
|
|
|
|
|
|
[[cat-count-api-example-all]]
|
|
|
|
===== Example with all indices in a cluster
|
2016-03-01 20:39:54 +08:00
|
|
|
|
2019-08-06 20:36:22 +08:00
|
|
|
The following `count` API request retrieves the document count of all indices in
|
|
|
|
the cluster.
|
2016-03-01 20:39:54 +08:00
|
|
|
|
2019-10-08 05:06:49 +08:00
|
|
|
[source,console,id=cat-count-all-example]
|
2013-11-15 09:14:39 +08:00
|
|
|
--------------------------------------------------
|
2019-08-06 20:36:22 +08:00
|
|
|
GET /_cat/count?v
|
2016-10-08 04:28:49 +08:00
|
|
|
--------------------------------------------------
|
2019-08-06 20:36:22 +08:00
|
|
|
// TEST[setup:big_twitter]
|
2019-10-11 17:23:55 +08:00
|
|
|
// TEST[s/^/POST test\/_doc\?refresh\n{"test": "test"}\n/]
|
2019-08-06 20:36:22 +08:00
|
|
|
|
|
|
|
The API returns the following response:
|
2016-10-08 04:28:49 +08:00
|
|
|
|
2016-10-25 22:56:30 +08:00
|
|
|
[source,txt]
|
2016-10-08 04:28:49 +08:00
|
|
|
--------------------------------------------------
|
|
|
|
epoch timestamp count
|
2019-08-06 20:36:22 +08:00
|
|
|
1475868259 15:24:20 121
|
2016-10-08 04:28:49 +08:00
|
|
|
--------------------------------------------------
|
2019-06-10 21:33:32 +08:00
|
|
|
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
|