88 lines
2.2 KiB
Plaintext
88 lines
2.2 KiB
Plaintext
[[cat-count]]
|
|
=== cat count API
|
|
++++
|
|
<titleabbrev>cat count</titleabbrev>
|
|
++++
|
|
|
|
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}
|
|
|
|
`GET /_cat/count/<index>`
|
|
|
|
`GET /_cat/count`
|
|
|
|
|
|
[[cat-count-api-path-params]]
|
|
==== {api-path-parms-title}
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
|
|
|
|
|
|
[[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 index
|
|
|
|
The following `count` API request retrieves the document count of a single
|
|
index, `twitter`.
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
GET /_cat/count/twitter?v
|
|
--------------------------------------------------
|
|
// TEST[setup:big_twitter]
|
|
|
|
|
|
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 indices in a cluster
|
|
|
|
The following `count` API request retrieves the document count of all indices in
|
|
the cluster.
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
GET /_cat/count?v
|
|
--------------------------------------------------
|
|
// TEST[setup:big_twitter]
|
|
// TEST[s/^/POST test\/test\?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]
|