<commit_before>[[cat-indices]]
== cat indices

The `indices` command provides a cross-section of each index.  This
information *spans nodes*.

[source,sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/indices/twi*?v'
health status index    pri rep docs.count docs.deleted store.size pri.store.size
green  open   twitter    5   1      11434            0       64mb           32mb
green  open   twitter2   2   0       2030            0      5.8mb          5.8mb
--------------------------------------------------

We can tell quickly how many shards make up an index, the number of
docs at the Lucene level, including hidden docs (e.g., from nested types), 
deleted docs, primary store size, and total store size (all shards including replicas). 
All these exposed metrics come directly from Lucene APIs.

[float]
[[pri-flag]]
=== Primaries

The index stats by default will show them for all of an index's
shards, including replicas.  A `pri` flag can be supplied to enable
the view of relevant stats in the context of only the primaries.

[float]
[[examples]]
=== Examples

Which indices are yellow?

[source,sh]
--------------------------------------------------
% curl localhost:9200/_cat/indices?health=yellow
yellow open  wiki     2 1  6401 1115 151.4mb 151.4mb
yellow open  twitter  5 1 11434    0    32mb    32mb
--------------------------------------------------

What's my largest index by disk usage not including replicas?

[source,sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/indices?bytes=b' | sort -rnk8
green open  wiki     2 0  6401 1115 158843725 158843725
green open  twitter  5 1 11434    0  67155614  33577857
green open  twitter2 2 0  2030    0   6125085   6125085
--------------------------------------------------

How many merge operations have the shards for the `wiki` completed?

[source,sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/indices/wiki?pri&v&h=health,index,prirep,docs.count,mt'
health index docs.count mt pri.mt
green  wiki        9646 16     16
--------------------------------------------------

How much memory is used per index?

[source,sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/indices?v&h=i,tm'
i     tm
wiki  8.1gb
test  30.5kb
user  1.9mb
--------------------------------------------------<commit_msg>Fixed typo in cat indices docs<commit_after>[[cat-indices]]
== cat indices

The `indices` command provides a cross-section of each index.  This
information *spans nodes*.

[source,sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/indices/twi*?v'
health status index    pri rep docs.count docs.deleted store.size pri.store.size
green  open   twitter    5   1      11434            0       64mb           32mb
green  open   twitter2   2   0       2030            0      5.8mb          5.8mb
--------------------------------------------------

We can tell quickly how many shards make up an index, the number of
docs at the Lucene level, including hidden docs (e.g., from nested types), 
deleted docs, primary store size, and total store size (all shards including replicas). 
All these exposed metrics come directly from Lucene APIs.

[float]
[[pri-flag]]
=== Primaries

The index stats by default will show them for all of an index's
shards, including replicas.  A `pri` flag can be supplied to enable
the view of relevant stats in the context of only the primaries.

[float]
[[examples]]
=== Examples

Which indices are yellow?

[source,sh]
--------------------------------------------------
% curl localhost:9200/_cat/indices?health=yellow
yellow open  wiki     2 1  6401 1115 151.4mb 151.4mb
yellow open  twitter  5 1 11434    0    32mb    32mb
--------------------------------------------------

What's my largest index by disk usage not including replicas?

[source,sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/indices?bytes=b' | sort -rnk8
green open  wiki     2 0  6401 1115 158843725 158843725
green open  twitter  5 1 11434    0  67155614  33577857
green open  twitter2 2 0  2030    0   6125085   6125085
--------------------------------------------------

How many merge operations have the shards for the `wiki` completed?

[source,sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/indices/wiki?pri&v&h=health,index,pri,rep,docs.count,mt'
health index docs.count mt pri.mt
green  wiki        9646 16     16
--------------------------------------------------

How much memory is used per index?

[source,sh]
--------------------------------------------------
% curl 'localhost:9200/_cat/indices?v&h=i,tm'
i     tm
wiki  8.1gb
test  30.5kb
user  1.9mb
--------------------------------------------------
{'fraction_non_alphanumeric': 0.26756756756756755, 'fraction_numerical': 0.0681912681912682, 'mean_word_length': 1.5005197505197505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '110118', 'n_tokens_mistral': 1481, 'n_tokens_neox': 1255, 'n_words': 495}