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 被拒绝的任务数
相关推荐
petrel20152 小时前
【Spark】性能与联通性的终极博弈:Spark on K8s 主机网络改造深度实战
大数据·网络·spark·kubernetes·claude code
小哥哥咯2 小时前
数据仓库维度建模思维导图—— 基于《The Data Warehouse Toolkit, 3rd Edition》(第三版修订版)
大数据·数据仓库
Moshow郑锴2 小时前
Spark与Prophecy综合比较&&推荐Prophecy的理由
大数据·分布式·spark
图特摩斯科技2 小时前
本体建模平台 OntoFlow & Palantir Ontology:从“数据实体”到“可执行本体”的企业落地路径
大数据
萤丰信息2 小时前
物联网+AI技术落地:重构园区管理新模式,激活产业发展新动能
大数据·人工智能·科技·物联网·重构·智慧园区
Qzkj6662 小时前
从风险失控到全程可控:高效好用、无故障、先进的金融API安全方案
大数据·安全·金融
2401_865854882 小时前
腾讯云龙虾大模型API配置:一键解锁AI算力,赋能业务高效升级
大数据·人工智能·腾讯云
新缸中之脑2 小时前
QMD:本地MD混合搜索引擎
jvm·搜索引擎
佳佳ckx666666cky3 小时前
拆解美团UV量提高的底层逻辑:从流量获取到留存的全链路优化
大数据·uv量提高·美团uv量提高·美团uv量·美团uv提高