cat indices API

edit

Returns high-level information about indices in a cluster, including backing indices for data streams.

Request

edit

GET /_cat/indices/<target>

GET /_cat/indices

Prerequisites

edit
  • If the Elasticsearch security features are enabled, you must have the monitor or manage cluster privilege to use this API. You must also have the monitor or manage index privilege for any data stream, index, or index alias you retrieve.

Description

edit

Use the cat indices API to get the following information for each index in a cluster:

  • Shard count
  • Document count
  • Deleted document count
  • Primary store size
  • Total store size of all shards, including shard replicas

These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents.

To get an accurate count of Elasticsearch documents, use the cat count or count APIs.

Path parameters

edit
<target>

(Optional, string) Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported.

To target all data streams and indices in a cluster, omit this parameter or use _all or *.

Query parameters

edit
bytes
(Optional, byte size units) Unit used to display byte values.
format
(Optional, string) Short version of the HTTP accept header. Valid values include JSON, YAML, etc.
h
(Optional, string) Comma-separated list of column names to display.
health

(Optional, string) Health status used to limit returned indices. Valid values are:

  • green
  • yellow
  • red

By default, the response includes indices of any health status.

help
(Optional, Boolean) If true, the response includes help information. Defaults to false.
include_unloaded_segments
(Optional, Boolean) If true, the response includes information from segments that are not loaded into memory. Defaults to false.
local
(Optional, Boolean) If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.
master_timeout
(Optional, time units) Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s.
pri (primary shards)
(Optional, Boolean) If true, the response only includes information from primary shards. Defaults to false.
s
(Optional, string) Comma-separated list of column names or column aliases used to sort the response.
time
(Optional, time units) Unit used to display time values.
v
(Optional, Boolean) If true, the response includes column headings. Defaults to false.
expand_wildcards

(Optional, string) Controls what kind of indices that wildcard expressions can expand to. Multiple values are accepted when separated by a comma, as in open,hidden. Valid values are:

all
Expand to open and closed indices, including hidden indices.
open
Expand only to open indices.
closed
Expand only to closed indices.
hidden
Expansion of wildcards will include hidden indices. Must be combined with open, closed, or both.
none
Wildcard expressions are not accepted.

Examples

edit
GET /_cat/indices/my-index-*?v=true&s=index

The API returns the following response:

health status index            uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   my-index-000001  u8FNjxh8Rfy_awN11oDKYQ   1   1       1200            0     88.1kb         88.1kb
green  open   my-index-000002  nYFWZEO7TUiOjLQXBaYJpA   1   0          0            0       260b           260b