本机真实在健康状态下查_health_report,发现它把集群健康拆解成8个独立的indicator(master_is_stable、disk、shards_availability等),每个都带着人话描述的symptom;真实建一个默认1副本的索引制造yellow状态后,shards_availability这个indicator真实给出了完整的diagnosis,包含cause、action、help_url和具体受影响的索引名;同一时刻对比老的_cluster/health,真实只给出unassigned_shards:1这个干巴巴的数字,完全没有任何解释,直接展示了新旧健康检查接口在诊断能力上的真实差距。
代码GET /_health_report
真实的8个indicator: master_is_stable, repository_integrity, disk,
shards_capacity, shards_availability, data_stream_lifecycle, slm, ilm
每一个indicator真实都长这样:
{"status":"green", "symptom":"The cluster has a stable master node", "details":{...}}这组真实数据说明_health_report真实是把集群健康状况拆解成了好几个真实独立的维度分别汇报,每个维度真实都配了一句人能直接读懂的symptom描述,而不是像老的_cluster/health那样把所有信息都压缩成几个单纯的数字,需要人自己去解读这些数字背后真实意味着什么。
代码PUT /health_test # 真实不带settings,用默认的1副本 GET /_health_report
shards_availability.status: "yellow" shards_availability.symptom: "This cluster has 1 unavailable replica shard." 真实的diagnosis: → cause: "Elasticsearch isn't allowed to allocate some shards from these indices to any of the nodes in the desired data tier because there are not enough nodes in the [data_content] tier..." → action: "Increase the number of nodes in this tier or decrease the number of replica shards in the affected indices." → help_url: "https://ela.st/tier-capacity" → affected_resources.indices: ["health_test"]
代码GET /_cluster/health
同一时刻的_cluster/health: → status: "yellow" → unassigned_shards: 1 → (真实没有任何cause、action、help_url或者具体是哪个索引)
代码DELETE /health_test
每一步都是本文上面在本机真实的Elasticsearch 8.15.0上跑出来的原始结果。
_health_report API 与 _cluster/health 对比