具有选定标头的人类可读表格 Cluster Health
示例使用基本 HTTP 语法。复制时,应删除示例中的任何 <#>
。
与 Elasticsearch 中的大多数 _cat
API 一样,API 会选择性地使用一组默认字段进行响应。但是,如果你需要 API,则存在其他字段:
GET /_cat/health?help <1>
?help
使 API 返回字段(和短名称)以及简要说明。
_cat/health
自 Elasticsearch 1.x 以来就已存在,但这里是 Elasticsearch 5.x 的输出示例:
可用于此示例的创建日期的字段:
epoch | t,time | seconds since 1970-01-01 00:00:00
timestamp | ts,hms,hhmmss | time in HH:MM:SS
cluster | cl | cluster name
status | st | health status
node.total | nt,nodeTotal | total number of nodes
node.data | nd,nodeData | number of nodes that can store data
shards | t,sh,shards.total,shardsTotal | total number of shards
pri | p,shards.primary,shardsPrimary | number of primary shards
relo | r,shards.relocating,shardsRelocating | number of relocating nodes
init | i,shards.initializing,shardsInitializing | number of initializing nodes
unassign | u,shards.unassigned,shardsUnassigned | number of unassigned shards
pending_tasks | pt,pendingTasks | number of pending tasks
max_task_wait_time | mtwt,maxTaskWaitTime | wait time of longest task pending
active_shards_percent | asp,activeShardsPercent | active number of shards in percent
然后,你可以使用它来仅打印这些字段:
GET /_cat/health?h=timestamp,cl,status&v <1>
h=...
定义了你想要返回的字段列表。v
(详细)定义你希望它打印标题。
Elasticsearch 5.x 实例的输出:
timestamp cl status
15:38:00 elasticsearch yellow