OpenSearch/docs/reference/cat/indices.asciidoc

104 lines
2.8 KiB
Plaintext

[[cat-indices]]
=== cat indices API
++++
<titleabbrev>cat indices</titleabbrev>
++++
Returns high-level information about indices in a cluster.
[[cat-indices-api-request]]
==== {api-request-title}
`GET /_cat/indices/<index>`
[[cat-indices-api-desc]]
==== {api-description-title}
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
https://lucene.apache.org/core/[Lucene], which {es} uses internally to power
indexing and search. As a result, all document counts include hidden
<<nested,nested>> documents.
To get an accurate count of {es} documents, use the <<cat-count,cat count>> or
<<search-count,count>> APIs.
[[cat-indices-api-path-params]]
==== {api-path-parms-title}
include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
[[cat-indices-api-query-params]]
==== {api-query-parms-title}
include::{docdir}/rest-api/common-parms.asciidoc[tag=bytes]
include::{docdir}/rest-api/common-parms.asciidoc[tag=http-format]
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-h]
`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.
--
include::{docdir}/rest-api/common-parms.asciidoc[tag=help]
include::{docdir}/rest-api/common-parms.asciidoc[tag=include-unloaded-segments]
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
[[pri-flag]]
`pri` (primary shards)::
(Optional, boolean) If `true`, the response only includes information from
primary shards. Defaults to `false`.
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-s]
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-v]
[[cat-indices-api-example]]
==== {api-examples-title}
[[examples]]
[source,js]
--------------------------------------------------
GET /_cat/indices/twi*?v&s=index
--------------------------------------------------
// CONSOLE
// TEST[setup:huge_twitter]
// TEST[s/^/PUT twitter2\n{"settings": {"number_of_replicas": 0}}\n/]
The API returns the following response:
[source,txt]
--------------------------------------------------
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open twitter u8FNjxh8Rfy_awN11oDKYQ 1 1 1200 0 88.1kb 88.1kb
green open twitter2 nYFWZEO7TUiOjLQXBaYJpA 1 0 0 0 260b 260b
--------------------------------------------------
// TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/]
// TESTRESPONSE[s/u8FNjxh8Rfy_awN11oDKYQ|nYFWZEO7TUiOjLQXBaYJpA/.+/ non_json]