123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- [[indices-stats]]
- === Index stats API
- ++++
- <titleabbrev>Index stats</titleabbrev>
- ++++
- Returns statistics for an index.
- [source,console]
- ----
- GET /twitter/_stats
- ----
- // TEST[setup:twitter]
- [[index-stats-api-request]]
- ==== {api-request-title}
- `GET /<index>/_stats/<index-metric>`
- `GET /<index>/_stats`
- `GET /_stats`
- [[index-stats-api-desc]]
- ==== {api-description-title}
- Use the index stats API to get high-level aggregation and statistics for an index.
- By default,
- the returned statistics are index-level
- with `primaries` and `total` aggregations.
- `primaries` are the values for only the primary shards.
- `total` are the accumulated values for both primary and replica shards.
- To get shard-level statistics,
- set the `level` parameter to `shards`.
- [NOTE]
- ====
- When moving to another node,
- the shard-level statistics for a shard are cleared.
- Although the shard
- is no longer part of the node,
- that node retains any node-level statistics
- to which the shard contributed.
- ====
- [[index-stats-api-path-params]]
- ==== {api-path-parms-title}
- include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
- +
- To retrieve statistics for all indices,
- use a value of `_all` or `*` or omit this parameter.
- include::{docdir}/rest-api/common-parms.asciidoc[tag=index-metric]
- [[index-stats-api-query-params]]
- ==== {api-query-parms-title}
- include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
- +
- Defaults to `open`.
- include::{docdir}/rest-api/common-parms.asciidoc[tag=fields]
- include::{docdir}/rest-api/common-parms.asciidoc[tag=completion-fields]
- include::{docdir}/rest-api/common-parms.asciidoc[tag=fielddata-fields]
- `forbid_closed_indices`::
- (Optional, boolean)
- If `true`, statistics are *not* collected from closed indices.
- Defaults to `true`.
- include::{docdir}/rest-api/common-parms.asciidoc[tag=groups]
- include::{docdir}/rest-api/common-parms.asciidoc[tag=level]
- include::{docdir}/rest-api/common-parms.asciidoc[tag=include-segment-file-sizes]
- include::{docdir}/rest-api/common-parms.asciidoc[tag=include-unloaded-segments]
- [[index-stats-api-example]]
- ==== {api-examples-title}
- [[index-stats-api-multiple-ex]]
- ===== Get statistics for multiple indices
- [source,console]
- --------------------------------------------------
- GET /index1,index2/_stats
- --------------------------------------------------
- // TEST[s/^/PUT index1\nPUT index2\n/]
- [[index-stats-api-all-ex]]
- ===== Get statistics for all indices
- [source,console]
- --------------------------------------------------
- GET /_stats
- --------------------------------------------------
- // TEST[setup:twitter]
- [[index-stats-api-specific-stats-ex]]
- ===== Get specific statistics
- The following request returns
- only the `merge` and `refresh` statistics
- for all indices.
- [source,console]
- --------------------------------------------------
- GET /_stats/merge,refresh
- --------------------------------------------------
- // TEST[setup:twitter]
- [[index-stats-api-specific-groups-ex]]
- ===== Get statistics for specific search groups
- The following request returns
- only search statistics
- for the `group1` and `group2` search groups.
- [source,console]
- --------------------------------------------------
- GET /_stats/search?groups=group1,group2
- --------------------------------------------------
- // TEST[setup:twitter]
|