Link Search Menu Expand Document Documentation Menu

CAT Count API

Introduced 1.0

The CAT count operation lists the number of documents in your cluster.

Endpoints

GET /_cat/count
GET /_cat/count/{index}

Query parameters

The following table lists the available query parameters. All query parameters are optional.

Parameter Data type Description Default
format String A short version of the Accept header, such as json or yaml. N/A
h List A comma-separated list of column names to display. N/A
help Boolean Returns help information. false
s List A comma-separated list of column names or column aliases to sort by. N/A
v Boolean Enables verbose mode, which displays column headers. false

Example requests

GET /_cat/count?v
response = client.cat.count(
  params = { "v": "true" }
)

To see the number of documents in a specific index or alias, add the index or alias name after your query:

GET /_cat/count/<index_or_alias>?v
response = client.cat.count(
  index = "<index_or_alias>",
  params = { "v": "true" }
)

If you want to get information for more than one index or alias, separate the index or alias names with commas:

GET /_cat/count/index_or_alias_1,index_or_alias_2,index_or_alias_3
response = client.cat.count(
  index = "index_or_alias_1,index_or_alias_2,index_or_alias_3"
)

Example response

The following response shows the overall document count as 1625:

epoch      | timestamp | count
1624237738 | 01:08:58  | 1625
350 characters left

Have a question? .

Want to contribute? or .