健康: 文档
# 集群健康
GET /_cat/health?v
#不带时间戳的
GET /_cat/health?v&ts=false
count: 文档
# 查询总数
GET /_cat/count?v
#查询某个索引的
GET /_cat/count/movies?v
索引:文档
# 查看索引
GET /_cat/indices
#查看某一个索引
GET /_cat/indices/movies?v
#查看yellow状态的索引
GET /_cat/indices?v&health=yellow
#根据文本数进行倒排序
GET /_cat/indices?v&s=docs.count:desc
节点:文档
# 查询整个节点
GET /_cat/nodes?v
# 后面跟参数(具体看文档,可以看很多内容)
GET /_cat/nodes?v&h=id,ip,port,v,m
cluster:文档
# 主要是使用这个api的filter,可以添加一系列filter来节点
# If no filters are given, the default is to select all nodes
GET /_nodes
# Explicitly select all nodes
GET /_nodes/_all
# Select just the local node
GET /_nodes/_local
# Select the elected master node
GET /_nodes/_master
# Select nodes by name, which can include wildcards
GET /_nodes/node_name_goes_here
GET /_nodes/node_name_goes_*
# Select nodes by address, which can include wildcards
GET /_nodes/10.0.0.3,10.0.0.4
GET /_nodes/10.0.0.*
# Select nodes by role
GET /_nodes/_all,master:false
GET /_nodes/data:true,ingest:true
GET /_nodes/coordinating_only:true
# Select nodes by custom attribute (e.g. with something like `node.attr.rack: 2` in the configuration file)
GET /_nodes/rack:2
GET /_nodes/ra*:2
GET /_nodes/ra*:2*
分片:文档(需要注意state字段)
# 查看所有分片
GET _cat/shards
#根据索引正则
GET _cat/shards/m*?v
#unassigned.reason可以查看未分配的原因
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason
state状态描述:
INDEX_CREATED Unassigned as a result of an API creation of an index.
CLUSTER_RECOVERED Unassigned as a result of a full cluster recovery.
INDEX_REOPENED Unassigned as a result of opening a closed index.
DANGLING_INDEX_IMPORTED Unassigned as a result of importing a dangling index引入危险索引()
NEW_INDEX_RESTORED Unassigned as a result of restoring into a new index.
EXISTING_INDEX_RESTORED Unassigned as a result of restoring into a closed index.
REPLICA_ADDED Unassigned as a result of explicit addition of a replica.
ALLOCATION_FAILED Unassigned as a result of a failed allocation of the shard.
NODE_LEFT Unassigned as a result of the node hosting it leaving the cluster.
REROUTE_CANCELLED Unassigned as a result of explicit cancel reroute command.
REINITIALIZED When a shard moves from started back to initializing, for example, with shadow replicas.
REALLOCATED_REPLICA A better replica location is identified and causes the existing replica allocation to be cancelled.