Skip to content

[DOCS] Reformat cat count API #45160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 61 additions & 14 deletions docs/reference/cat/count.asciidoc
Original file line number Diff line number Diff line change
@@ -1,41 +1,88 @@
[[cat-count]]
=== cat count

`count` provides quick access to the document count of the entire
cluster, or individual indices.
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}`


[[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=local]

include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]

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`.

[source,js]
--------------------------------------------------
GET /_cat/count?v
GET /_cat/count/twitter?v
--------------------------------------------------
// CONSOLE
// TEST[setup:big_twitter]
// TEST[s/^/POST test\/test\?refresh\n{"test": "test"}\n/]

Looks like:

The API returns the following response:

[source,txt]
--------------------------------------------------
epoch timestamp count
1475868259 15:24:19 121
1475868259 15:24:20 120
--------------------------------------------------
// TESTRESPONSE[s/1475868259 15:24:19/\\d+ \\d+:\\d+:\\d+/ non_json]
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]

[[cat-count-api-example-all]]
===== Example with all indices in a cluster

Or for a single index:
The following `count` API request retrieves the document count of all indices in
the cluster.

[source,js]
--------------------------------------------------
GET /_cat/count/twitter?v
GET /_cat/count?v
--------------------------------------------------
// CONSOLE
// TEST[continued]
// 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 120
1475868259 15:24:20 121
--------------------------------------------------
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]


NOTE: The document count indicates the number of live documents and does not include deleted documents which have not yet been cleaned up by the merge process.
6 changes: 6 additions & 0 deletions docs/reference/rest-api/common-parms.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html[HTTP accept header].
Valid values include JSON, YAML, etc.
end::http-format[]

tag::index[]
`{index}`::
(Optional, string) Comma-separated list of index names used to limit returned
information.
end::index[]

tag::local[]
`local`::
(Optional, boolean) If `true`, the request retrieves information from the local
Expand Down