Skip to content

Commit 2016e26

Browse files
committed
[DOCS] Reformat cat count API (#45160)
1 parent ac4bf89 commit 2016e26

File tree

2 files changed

+67
-14
lines changed

2 files changed

+67
-14
lines changed

docs/reference/cat/count.asciidoc

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,88 @@
11
[[cat-count]]
22
=== cat count
33

4-
`count` provides quick access to the document count of the entire
5-
cluster, or individual indices.
4+
Provides quick access to a document count of individual indices or all indices
5+
in a cluster.
6+
7+
NOTE: The document count only includes live documents, not deleted documents
8+
which have not yet been removed by the merge process.
9+
10+
11+
[[cat-count-api-request]]
12+
==== {api-request-title}
13+
14+
`GET /_cat/count/{index}`
15+
16+
17+
[[cat-count-api-path-params]]
18+
==== {api-path-parms-title}
19+
20+
include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
21+
22+
23+
[[cat-count-api-query-params]]
24+
==== {api-query-parms-title}
25+
26+
include::{docdir}/rest-api/common-parms.asciidoc[tag=http-format]
27+
28+
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-h]
29+
30+
include::{docdir}/rest-api/common-parms.asciidoc[tag=help]
31+
32+
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
33+
34+
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
35+
36+
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-s]
37+
38+
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-v]
39+
40+
41+
[[cat-count-api-example]]
42+
==== {api-examples-title}
43+
44+
[[cat-count-api-example-ind]]
45+
===== Example with an individual index
46+
47+
The following `count` API request retrieves the document count of a single
48+
index, `twitter`.
649

750
[source,js]
851
--------------------------------------------------
9-
GET /_cat/count?v
52+
GET /_cat/count/twitter?v
1053
--------------------------------------------------
1154
// CONSOLE
1255
// TEST[setup:big_twitter]
13-
// TEST[s/^/POST test\/test\?refresh\n{"test": "test"}\n/]
1456

15-
Looks like:
57+
58+
The API returns the following response:
1659

1760
[source,txt]
1861
--------------------------------------------------
1962
epoch timestamp count
20-
1475868259 15:24:19 121
63+
1475868259 15:24:20 120
2164
--------------------------------------------------
22-
// TESTRESPONSE[s/1475868259 15:24:19/\\d+ \\d+:\\d+:\\d+/ non_json]
65+
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
66+
67+
[[cat-count-api-example-all]]
68+
===== Example with all indices in a cluster
2369

24-
Or for a single index:
70+
The following `count` API request retrieves the document count of all indices in
71+
the cluster.
2572

2673
[source,js]
2774
--------------------------------------------------
28-
GET /_cat/count/twitter?v
75+
GET /_cat/count?v
2976
--------------------------------------------------
3077
// CONSOLE
31-
// TEST[continued]
78+
// TEST[setup:big_twitter]
79+
// TEST[s/^/POST test\/test\?refresh\n{"test": "test"}\n/]
80+
81+
The API returns the following response:
3282

3383
[source,txt]
3484
--------------------------------------------------
3585
epoch timestamp count
36-
1475868259 15:24:20 120
86+
1475868259 15:24:20 121
3787
--------------------------------------------------
3888
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ non_json]
39-
40-
41-
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.

docs/reference/rest-api/common-parms.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html[HTTP accept header].
2222
Valid values include JSON, YAML, etc.
2323
end::http-format[]
2424

25+
tag::index[]
26+
`{index}`::
27+
(Optional, string) Comma-separated list of index names used to limit returned
28+
information.
29+
end::index[]
30+
2531
tag::local[]
2632
`local`::
2733
(Optional, boolean) If `true`, the request retrieves information from the local

0 commit comments

Comments
 (0)