2013-08-28 19:24:34 -04:00
[[indices-stats]]
2019-07-19 14:35:36 -04:00
=== Indices Stats
2013-08-28 19:24:34 -04:00
Indices level stats provide statistics on different operations happening
on an index. The API provides statistics on the index level scope
(though most stats can also be retrieved using node level scope).
The following returns high level aggregation and index level stats for
all indices:
[source,js]
--------------------------------------------------
2016-09-02 18:22:30 -04:00
GET /_stats
2013-08-28 19:24:34 -04:00
--------------------------------------------------
2016-09-02 18:22:30 -04:00
// CONSOLE
2013-08-28 19:24:34 -04:00
Specific index stats can be retrieved using:
[source,js]
--------------------------------------------------
2016-09-02 18:22:30 -04:00
GET /index1,index2/_stats
2013-08-28 19:24:34 -04:00
--------------------------------------------------
2016-09-02 18:22:30 -04:00
// CONSOLE
// TEST[s/^/PUT index1\nPUT index2\n/]
2013-08-28 19:24:34 -04:00
2013-12-11 06:09:59 -05:00
By default, all stats are returned, returning only specific stats can be
specified as well in the URI. Those stats can be any of:
2013-08-28 19:24:34 -04:00
[horizontal]
`docs`:: The number of docs / deleted docs (docs not yet merged out).
Note, affected by refreshing the index.
`store`:: The size of the index.
`indexing`:: Indexing statistics, can be combined with a comma
separated list of `types` to provide document type level stats.
`get`:: Get statistics, including missing stats.
2016-03-23 14:39:46 -04:00
`search`:: Search statistics including suggest statistics.
You can include statistics for custom groups by adding
2013-10-31 22:31:02 -04:00
an extra `groups` parameter (search operations can be associated with one or more
groups). The `groups` parameter accepts a comma separated list of group names.
Use `_all` to return statistics for all groups.
2013-08-28 19:24:34 -04:00
2016-02-19 16:25:42 -05:00
`segments`:: Retrieve the memory use of the open segments. Optionally, setting the `include_segment_file_sizes` flag, report the aggregated disk usage of each one of the Lucene index files.
2014-08-06 05:54:51 -04:00
`completion`:: Completion suggest statistics.
`fielddata`:: Fielddata statistics.
`flush`:: Flush statistics.
`merge`:: Merge statistics.
2015-06-26 10:31:38 -04:00
`request_cache`:: <<shard-request-cache,Shard request cache>> statistics.
2014-08-06 05:54:51 -04:00
`refresh`:: Refresh statistics.
`warmer`:: Warmer statistics.
2014-10-29 01:43:17 -04:00
`translog`:: Translog statistics.
2014-08-06 05:54:51 -04:00
Some statistics allow per field granularity which accepts a list
comma-separated list of included fields. By default all fields are included:
2013-09-16 04:21:25 -04:00
[horizontal]
2014-08-06 05:54:51 -04:00
`fields`::
List of fields to be included in the statistics. This is used as the
default list unless a more specific field list is provided (see below).
`completion_fields`::
List of fields to be included in the Completion Suggest statistics.
`fielddata_fields`::
List of fields to be included in the Fielddata statistics.
2013-09-16 04:21:25 -04:00
2013-08-28 19:24:34 -04:00
Here are some samples:
[source,js]
--------------------------------------------------
2013-12-11 06:09:59 -05:00
# Get back stats for merge and refresh only for all indices
2016-09-02 18:22:30 -04:00
GET /_stats/merge,refresh
2013-08-28 19:24:34 -04:00
# Get back stats for type1 and type2 documents for the my_index index
2016-09-02 18:22:30 -04:00
GET /my_index/_stats/indexing?types=type1,type2
2013-10-31 22:31:02 -04:00
# Get back just search stats for group1 and group2
2016-09-02 18:22:30 -04:00
GET /_stats/search?groups=group1,group2
2013-08-28 19:24:34 -04:00
--------------------------------------------------
2016-09-02 18:22:30 -04:00
// CONSOLE
// TEST[s/^/PUT my_index\n/]
2013-08-28 19:24:34 -04:00
The stats returned are aggregated on the index level, with
2015-06-22 17:49:45 -04:00
`primaries` and `total` aggregations, where `primaries` are the values for only the
2019-01-07 08:44:12 -05:00
primary shards, and `total` are the accumulated values for both primary and replica shards.
2015-06-19 10:47:15 -04:00
In order to get back shard level stats, set the `level` parameter to `shards`.
2013-08-28 19:24:34 -04:00
Note, as shards move around the cluster, their stats will be cleared as
they are created on other nodes. On the other hand, even though a shard
"left" a node, that node will still retain the stats that shard
contributed to.