Index stats APIedit
Returns statistics for an index.
GET /twitter/_stats
Descriptionedit
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
.
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.
Path parametersedit
-
<index>
-
(Optional, string) Comma-separated list or wildcard expression of index names used to limit the request.
To retrieve statistics for all indices, use a value of
_all
or*
or omit this parameter. -
<index-metric>
-
(Optional, string) Comma-separated list of metrics used to limit the request. Supported metrics are:
-
_all
- Return all statistics.
-
completion
- Completion suggester statistics.
-
docs
- Number of documents and deleted docs, which have not yet merged out. Index refreshes can affect this statistic.
-
fielddata
- Fielddata statistics.
-
flush
- Flush statistics.
-
get
- Get statistics, including missing stats.
-
indexing
- Indexing statistics.
-
merge
- Merge statistics.
-
query_cache
- Query cache statistics.
-
refresh
- Refresh statistics.
-
request_cache
- Shard request cache statistics.
-
search
-
Search statistics including suggest statistics.
You can include statistics for custom groups
by adding an extra
groups
parameter (search operations can be associated with one or more groups). Thegroups
parameter accepts a comma separated list of group names. Use_all
to return statistics for all groups. -
segments
-
Memory use of all open segments.
If the
include_segment_file_sizes
parameter istrue
, this metric includes the aggregated disk usage of each Lucene index file. -
store
- Size of the index in byte units.
-
suggest
- Suggester statistics.
-
translog
- Translog statistics.
-
warmer
- Warmer statistics.
-
Query parametersedit
-
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.
Defaults to
open
. -
-
fields
-
(Optional, string) Comma-separated list or wildcard expressions of fields to include in the statistics.
Used as the default list unless a specific field list is provided in the
completion_fields
orfielddata_fields
parameters. -
completion_fields
-
(Optional, string)
Comma-separated list or wildcard expressions of fields
to include in
fielddata
andsuggest
statistics. -
fielddata_fields
-
(Optional, string)
Comma-separated list or wildcard expressions of fields
to include in
fielddata
statistics. -
forbid_closed_indices
-
(Optional, boolean)
If
true
, statistics are not collected from closed indices. Defaults totrue
. -
groups
-
(Optional, string)
Comma-separated list of search groups
to include in the
search
statistics. -
level
-
(Optional, string) Indicates whether statistics are aggregated at the cluster, index, or shard level.
Valid values are:
-
cluster
-
indices
-
shards
-
-
include_segment_file_sizes
-
(Optional, boolean)
If
true
, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). Defaults tofalse
. -
include_unloaded_segments
-
(Optional, boolean) If
true
, the response includes information from segments that are not loaded into memory. Defaults tofalse
.
Examplesedit
Get statistics for multiple indicesedit
GET /index1,index2/_stats
Get statistics for all indicesedit
GET /_stats
Get specific statisticsedit
The following request returns
only the merge
and refresh
statistics
for all indices.
GET /_stats/merge,refresh
Get statistics for specific search groupsedit
The following request returns
only search statistics
for the group1
and group2
search groups.
GET /_stats/search?groups=group1,group2