|
1 | 1 | [[cat-count]]
|
2 | 2 | === cat count
|
3 | 3 |
|
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`. |
6 | 49 |
|
7 | 50 | [source,js]
|
8 | 51 | --------------------------------------------------
|
9 |
| -GET /_cat/count?v |
| 52 | +GET /_cat/count/twitter?v |
10 | 53 | --------------------------------------------------
|
11 | 54 | // CONSOLE
|
12 | 55 | // TEST[setup:big_twitter]
|
13 |
| -// TEST[s/^/POST test\/test\?refresh\n{"test": "test"}\n/] |
14 | 56 |
|
15 |
| -Looks like: |
| 57 | + |
| 58 | +The API returns the following response: |
16 | 59 |
|
17 | 60 | [source,txt]
|
18 | 61 | --------------------------------------------------
|
19 | 62 | epoch timestamp count
|
20 |
| -1475868259 15:24:19 121 |
| 63 | +1475868259 15:24:20 120 |
21 | 64 | --------------------------------------------------
|
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 |
23 | 69 |
|
24 |
| -Or for a single index: |
| 70 | +The following `count` API request retrieves the document count of all indices in |
| 71 | +the cluster. |
25 | 72 |
|
26 | 73 | [source,js]
|
27 | 74 | --------------------------------------------------
|
28 |
| -GET /_cat/count/twitter?v |
| 75 | +GET /_cat/count?v |
29 | 76 | --------------------------------------------------
|
30 | 77 | // 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: |
32 | 82 |
|
33 | 83 | [source,txt]
|
34 | 84 | --------------------------------------------------
|
35 | 85 | epoch timestamp count
|
36 |
| -1475868259 15:24:20 120 |
| 86 | +1475868259 15:24:20 121 |
37 | 87 | --------------------------------------------------
|
38 | 88 | // 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. |
|
0 commit comments