Elasticsearch经过使用JSON来做为沟通的数据格式,这对于开发者来讲很友好,由于不少程序都支持JSON格式。好比js就不说了,Java也有fastjson,ruby什么的都自带json。node
Elasticsearch中信息不少,若是单凭肉眼来寻找复杂数据之间的关系,是很困难的。所以cat命令应运而生,它帮助开发者快速查询Elasticsearch的相关信息。json
经过使用_cat能够查看支持的命令:ruby
$ curl localhost:9200/_cat =^.^= /_cat/allocation /_cat/shards /_cat/shards/{index} /_cat/master /_cat/nodes /_cat/indices /_cat/indices/{index} /_cat/segments /_cat/segments/{index} /_cat/count /_cat/count/{index} /_cat/recovery /_cat/recovery/{index} /_cat/health /_cat/pending_tasks /_cat/aliases /_cat/aliases/{alias} /_cat/thread_pool /_cat/plugins /_cat/fielddata /_cat/fielddata/{fields} /_cat/nodeattrs /_cat/repositories /_cat/snapshots/{repository}
每一个命令都支持使用?v参数,来显示详细的信息:curl
$ curl localhost:9200/_cat/master?v id host ip node QG6QrX32QSi8C3-xQmrSoA 127.0.0.1 127.0.0.1 Manslaughter
每一个命令都支持使用help参数,来输出能够显示的列:url
$ curl localhost:9200/_cat/master?help id | | node id host | h | host name ip | | ip address node | n | node name
经过h参数,能够指定输出的字段:code
$ curl localhost:9200/_cat/master?v id host ip node QG6QrX32QSi8C3-xQmrSoA 127.0.0.1 127.0.0.1 Manslaughter $ curl localhost:9200/_cat/master?h=host,ip,node 127.0.0.1 127.0.0.1 Manslaughter
不少的命令都支持返回可读性的大小数字,好比使用mb或者kb来表示。ip
$ curl localhost:9200/_cat/indices?v health status index pri rep docs.count docs.deleted store.size pri.store.size yellow open test 5 1 3 0 9.2kb 9.2kb