Elasticsearch 常用请求说明

数据相关操作
1. 查看索引
shell 复制代码
# curl 'localhost:9200/_cat/indices?v'
health status index        uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   iothroughput 7jX7E93_RmS3noSF2JcT2w   5   1   36461703            1      7.4gb          7.4gb
yellow open   instance     400jL_KQRjawFM8At2_gPw   5   1       1319           62      6.1mb          6.1mb
yellow open   cpu          kbc5hEzrQhaxaucWUo3nkw   5   1   36461706         2261      3.9gb          3.9gb
yellow open   osd_usage    RvQW6LJHQs--me6MVVamWA   5   1    6744024            6      4.6gb          4.6gb
yellow open   ceph_stat    7ZfRADUHQwqEWjpsbbFxqg   5   1    6744026          160    564.1mb        564.1mb
yellow open   images_usage 5EOFsX4VQJuDVSLVk2ZOcg   5   1    6744026          459      523mb          523mb
yellow open   bandwidth    qdVLnWesT7qiszU_nnzOsw   5   1   36461694            0     29.4gb         29.4gb
yellow open   memory       L7lV8iz4SSKCGf_eNjIX7Q   5   1   36461689         4615      4.8gb          4.8gb
yellow open   iops         pMU-AtalR1O8Qs_-E9AfPQ   5   1   36461686         2868      4.9gb          4.9gb
yellow open   diskusage    W6kWHG4kT3Wz2N_1Rsz5NQ   5   1    6744030          345      1.1gb          1.1gb
字段 说明
health 健康状态
status 状态
index 索引名
uuid uuid
pri 索引主分片数
rep 索引副本分片数量
docs.count 索引中文档总数
docs.deleted 索引中删除状态的文档
store.size 主分片+副本分分片的大小
pri.store.size 主分片的大小
2. 查看索引数据
shell 复制代码
# curl 'localhost:9200/索引/_search?pretty=1'
{
    "took": 2,
    "timed_out": false,
    "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
    },
    "hits": {
        "total": 1,
        "max_score": 1.0,
        "hits": [{
                "_index": "apu_memory_utilization",
                "_type": "json",
                "_id": "YXB1X21lbW9yeV91dGlsaXphdGlvbjIwMjItMDUtMDYgMTA6MzhpLXh5dGZzandl",
                "_score": 1.0,
                "_source": {
                    "date": "2022-05-06T10:38:47",
                    "instance": "i-xytfsjwe",
                    "uuid": "c6802b54-7136-d76c-8242d2b1dc808",
                    "value": 0.53
                }
            }
        ]
    }
}
4. 删除索引
shell 复制代码
# curl -XDELETE localhost:9200/索引,索引,索引...
{"acknowledged":true}
3. 集群状态
shell 复制代码
# curl 'localhost:9200/_cat/health?v'
epoch      timestamp cluster         status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1642388911 11:08:31  hive_es_cluster green           3         3     80  40    0    0        0             0                  -                100.0%
字段 说明
epoch 自标准时间(1970-01-01 00:00:00)以来的秒数
timestamp 时分秒,utc时区
cluster 集群名称
status 集群状态
node.total 节点总数
node.data 数据节点总数
shards 分片总数
pri 主分片总数
relo 复制节点总数
init 初始化节点总数
unassign 未分配分片总数
pending_tasks 待定任务总数
max_task_wait_time 等待最长任务的等待时间
active_shards_percent 活动分片百分比
4. 节点信息
shell 复制代码
# curl 'localhost:9200/_cat/master?v'
id                     host           ip             node
0Fob0_DSQsa9RQV4oAC4HQ 172.25.254.246 172.25.254.246 node2


# curl 'localhost:9200/_cat/nodes?v'
es@i-durevgsc:/root$ curl '172.25.254.250:9200/_cat/nodes?v'
ip             heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.25.254.250           19           0  -1    0.23    0.14     0.06 mdi       -      node1
172.25.254.246           20           0  -1    0.07    0.15     0.07 mdi       *      node2
172.25.254.248           19           0  -1    0.03    0.08     0.03 mdi       -      node3
字段 说明
id ip
heap.percent 堆内存占用百分比
ram.percent 内存占用百分比
cpu CPU占用百分比
load_1m 1分钟的系统负载
load_5m 5分钟的系统负载
load_15m 15分钟的系统负载
node.role node节点的角色
master 是否是master节点
name 节点名称
5. 空间使用情况
shell 复制代码
# curl 'localhost:9200/_cat/allocation?v'
shards disk.indices disk.used disk.avail disk.total disk.percent host           ip             node
    27        4.9mb       4gb     75.1gb     79.2gb            5 172.25.254.246 172.25.254.246 node2
    27          6mb       4gb     75.1gb     79.2gb            5 172.25.254.248 172.25.254.248 node3
    26        6.2mb       4gb     75.1gb     79.2gb            5 172.25.254.250 172.25.254.250 node1
字段 说明
shards 节点承载的分片数量
disk.indices 索引占用的空间大小
disk.used 节点所在机器已使用的磁盘空间大下
disk.avail 节点可用空间大小
disk.total 节点总空间大小
disk.percent 节点磁盘占用百分比
host 节点host
ip 节点ip
node 节点名称
6. 线程信息
shell 复制代码
# curl 'localhost:9200/_cat/thread_pool?v'
node_name name                active queue rejected
node1     bulk                     0     0        0
node1     fetch_shard_started      0     0        0
node1     fetch_shard_store        0     0        0
node1     flush                    0     0        0
node1     force_merge              0     0        0
node1     generic                  0     0        0
node1     get                      0     0        0
node1     index                    0     0        0
node1     listener                 0     0        0
node1     management               1     0        0
node1     refresh                  0     0        0
node1     search                   0     0        0
node1     snapshot                 0     0        0
node1     warmer                   0     0        0
node2     bulk                     0     0        0
node2     fetch_shard_started      0     0        0
node2     fetch_shard_store        0     0        0
node2     flush                    0     0        0
node2     force_merge              0     0        0
node2     generic                  0     0        0
node2     get                      0     0        0
node2     index                    0     0        0
字段 说明
node_name 节点名称
name 线程池名称
active 活跃线程数
queue 当前队列中的任务数
rejected 被拒绝的任务数
相关推荐
SeaTunnel7 小时前
(八)收官篇 | 数据平台最后一公里:数据集成开发设计与上线治理实战
java·大数据·开发语言·白鲸开源
IT研究所9 小时前
AI 时代下的知识管理:从 Claude 的“复盘”能力看生成式 AI价值
大数据·运维·数据库·人工智能·科技·低代码·自然语言处理
云边云科技_云网融合10 小时前
企业出海的 “数字丝绸之路“:SD-WAN 如何重构全球网络竞争力
大数据·运维·网络·人工智能
JZC_xiaozhong10 小时前
2026年深圳企业如何统一管理ERP、MES、OA权限?身份识别与访问管理高效方案
大数据·运维·自动化·企业数据安全·数据集成与应用集成·权限治理·多系统权限管理
老陈头聊SEO10 小时前
长尾关键词策略提升SEO效果的最新分析与实践分享
其他·搜索引擎·seo优化
1892280486111 小时前
NV243美光MT29F32T08GWLBHD6-24QJES:B
大数据·服务器·人工智能·科技·缓存
2601_9585484811 小时前
利川避暑民宿舒适化运营:客流增长策略深度解析
大数据
明明跟你说过11 小时前
Kafka 与 Elasticsearch 的集成应用案例深度解析
大数据·elk·elasticsearch·kafka·big data·bigdata
拾-光11 小时前
【Git】命令大全:从入门到高手,100 个最常用命令速查(2026 版)
java·大数据·人工智能·git·python·elasticsearch·设计模式
醉颜凉11 小时前
Elasticsearch 实战:数据自动化清理完全指南(ILM + 定时删除 + 最佳实践)
elasticsearch·自动化·jenkins