- green: 主副分片都正常分配
- yellow: 主分片都正常分配, 但是有副本分片没有正常分配
- red: 有主分片没有分配
```java
一些集群和节点的统计信息
Node Stats:
GET _nodes/stats
Cluster Stats:
GET _cluster/stats
索引级别的统计信息
Index Stats:
GET kibana_sample_data_ecommerce/_stats
查看pending的任务
Pending Cluster Tasks API:
GET _cluster/pending_tasks
查看所有的 tasks,也支持 cancel task
GET _tasks
查看线程池的
GET _nodes/thread_pool GET _nodes/stats/thread_pool GET _cat/thread_pool?v
查看热点线程
GET _nodes/hot_threads GET _nodes/stats/thread_pool
健康状态
```shell
GET /_cluster/health查看
{
"cluster_name": "re***rch", # 集群名称
"status": "green", # 集群状态
"timed_out": false, # 如果false响应在timeout参数指定的时间段内返回(30s默认情况下)
"number_of_nodes": 3, # 集群中的节点数
"number_of_data_nodes": 3, # 作为数据节点的节点数
"active_primary_shards": 6, # 活动主分区的数量
"active_shards": 12, # 活动主分区和副本分区的总数
"relocating_shards": 0, # 正在重定位的分片的数量
"initializing_shards": 0, # 正在初始化的分片数
"unassigned_shards": 0, # 未分配的分片数
"delayed_unassigned_shards": 0, # 其分配因超时设置而延迟的分片数
"number_of_pending_tasks": 0, #尚未执行的集群级别更改的数量
"number_of_in_flight_fetch": 0, # 未完成的访存数量
"task_max_waiting_in_queue_millis": 0, # 自最早的初始化任务等待执行以来的时间
"active_shards_percent_as_number": 100 # 群集中活动碎片的比率,以百分比表示
}
设置慢查询
# 触发这些的会被记录
PUT my_index/
{
"settings": {
"index.search.slowlog.threshold": {
"query.warn": "10s",
"query.info": "3s",
"query.debug": "2s",
"query.trace": "0s",
"fetch.warn": "1s",
"fetch.info": "600ms",
"fetch.debug": "400ms",
"fetch.trace": "0s"
}
}
}