2013-08-28 19:24:34 -04:00
|
|
|
[[indices-stats]]
|
2019-09-05 15:03:33 -04:00
|
|
|
=== Index stats API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Index stats</titleabbrev>
|
|
|
|
++++
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
Returns statistics for an index.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
[source,console]
|
|
|
|
----
|
|
|
|
GET /twitter/_stats
|
|
|
|
----
|
|
|
|
// TEST[setup:twitter]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
[[index-stats-api-request]]
|
|
|
|
==== {api-request-title}
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
`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.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=index-metric]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
[[index-stats-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
|
|
|
|
+
|
|
|
|
Defaults to `open`.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=fields]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=completion-fields]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=fielddata-fields]
|
2016-02-19 16:25:42 -05:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
`forbid_closed_indices`::
|
|
|
|
(Optional, boolean)
|
|
|
|
If `true`, statistics are *not* collected from closed indices.
|
|
|
|
Defaults to `true`.
|
2014-08-06 05:54:51 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=groups]
|
2013-09-16 04:21:25 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=level]
|
2014-08-06 05:54:51 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=include-segment-file-sizes]
|
2014-08-06 05:54:51 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=include-unloaded-segments]
|
2014-08-06 05:54:51 -04:00
|
|
|
|
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
[[index-stats-api-example]]
|
|
|
|
==== {api-examples-title}
|
2014-08-06 05:54:51 -04:00
|
|
|
|
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
[[index-stats-api-multiple-ex]]
|
|
|
|
===== Get statistics for multiple indices
|
2013-09-16 04:21:25 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
[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
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
The following request returns
|
|
|
|
only the `merge` and `refresh` statistics
|
|
|
|
for all indices.
|
|
|
|
|
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2016-09-02 18:22:30 -04:00
|
|
|
GET /_stats/merge,refresh
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2019-09-05 15:03:33 -04:00
|
|
|
// TEST[setup:twitter]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2015-06-19 10:47:15 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
[[index-stats-api-specific-groups-ex]]
|
|
|
|
===== Get statistics for specific search groups
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-05 15:03:33 -04:00
|
|
|
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]
|