cat indices

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.0/cat-indices.html

译文链接 : http://www.apache.wiki/display/Elasticsearch/cat+indices

贡献者 : 那伊抹微笑

indices 命令提供了每一个索引的 cross-section(横截面)。这些信息跨越了多个节点。

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

我们可以很快的知道一个索引的分片数量,Lucene 级别的文档数量,包括隐藏的文档(例如,嵌套的类型),已删除的文档,主存储的大小,和总存储大小(包括副本在内的所有分片)。这些暴漏的 metric(度量)直接来自 Lucene API

Primaries

默认情况下,索引的统计信息将显示它们所有的索引分片,包括副本。提供一个 pri 标记可以只查看 primaries context 中的相关统计信息。

示例

哪些索引是 yellow

  1. % curl localhost:9200/_cat/indices?health=yellow
  2. yellow open wiki 2 1 6401 1115 151.4mb 151.4mb
  3. yellow open twitter 5 1 11434 0 32mb 32mb

什么索引使用的硬盘空间最大(不包括副本)?

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

wiki 索引的分片中有多少合并操作已完成?

  1. % curl 'localhost:9200/_cat/indices/wiki?pri&v&h=health,index,pri,rep,docs.count,mt'
  2. health index docs.count mt pri.mt
  3. green wiki 9646 16 16

每一个索引使用了多少内存?

  1. % curl 'localhost:9200/_cat/indices?v&h=i,tm'
  2. i tm
  3. wiki 8.1gb
  4. test 30.5kb
  5. user 1.9mb