实践中ES常用命令总结

一.集群状况查看命令

1.1集群健康度

curl http://localhost:9200/_cat/health?v

1.2 集群节点

curl http://localhost:9200/_cat/nodes?v

1.3 集群索引

curl http://localhost:9200/_cat/indices?v

1.4 查看某个索引段

curl http://localhost:9200/_cat/segments/order_index?v

1.5 查看索引mapping

curl -XGET http://localhost:9200/order_202203/_mapping?pretty

1.6 查看索引模板

curl -XGET http://localhost:9200/_template?pretty

1.7查看索引settings

curl -XGET http://localhost:9200/order_2022/_settings?pretty

1.8查看索引分片信息

curl -XGET http://localhost:9200/order_202204/_search_shards?pretty

1.9 集群当前线程池

curl -XGET http://localhost:9200/_cat/thread_pool?v

1.9.1 查看当前热线程

curl -XGET http://localhost:9200/_nodes/hot_threads

1.9.2查询索引设置信息

 curl http://localhost:9200/order_20231016/_stats?pretty

1.9.3设置es索引刷新时间

curl -XPUT -H "Content-Type:application/json" http://192.168.30.23:9200/order_es_index/_settings -d '{"index":{"refresh_interval":"500ms"}}'

二.索引相关操作命令

2.1 查看某个索引的数据

curl -XGET http://localhost:9200/order_202203/_search?pretty

2.2 查看某个索引分片

curl http://localhost:9200/_cat/shards/order_202109

2.3 通过orderId删除某个记录

curl -XDELETE http://localhost:9200/order_202201/order/515369856

2.4 修改mappping,添加字段

curl -XPOST 'localhost:9200/order_202202/order/_mapping?pretty' -H 'Content-Type:application/json' -d'{"order":{"properties":{"utime":{"format":"dateOptionalTime","type":"date"}}}}'

2.5 更新某个索引每个分片的segment

curl -XPOST http://localhost:9200/order_2022/_forcemerge?max_num_segments=1

2.6 更新某个记录的字段,通过orderId

curl -XPOST 'http://localhost:9200/order_2020/order/273743833/_update' -d '{ "doc": {  "status": 61 }}'

2.7 关闭索引

curl -XPOST http://127.0.0.1:9200/order_20230320/_close?pretty

2.8 删除索引

curl -XDELETE 'http://127.0.0.1:9200/order_week_20230320'

2.9 创建索引通过模板

curl -XPUT 'http://127.0.0.1:9200/order_week_20230320'

3.0 设置es日志超时打印时间

es的写入、查询慢日志加一下

PUT /_all/_settings

{

"index.search.slowlog.threshold.query.warn":"1s",

"index.search.slowlog.threshold.query.info":"300ms",

"index.search.slowlog.threshold.query.trace":"200ms",

"index.search.slowlog.threshold.fetch.warn":"1s",

"index.search.slowlog.threshold.fetch.info":"300ms",

"index.search.slowlog.threshold.fetch.trace":"200ms",

"index.indexing.slowlog.threshold.index.warn":"1s",

"index.indexing.slowlog.threshold.index.info":"300ms",

"index.indexing.slowlog.threshold.index.trace":"200ms"

}

相关推荐

  1. 实践ES命令总结

    2024-06-13 07:02:04       5 阅读
  2. Docker命令总结

    2024-06-13 07:02:04       43 阅读
  3. Linux命令总结

    2024-06-13 07:02:04       36 阅读
  4. vim命令总结

    2024-06-13 07:02:04       35 阅读
  5. conda命令总结

    2024-06-13 07:02:04       38 阅读
  6. conda命令总结

    2024-06-13 07:02:04       30 阅读
  7. Linux命令总结

    2024-06-13 07:02:04       38 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-13 07:02:04       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-13 07:02:04       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-13 07:02:04       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-13 07:02:04       20 阅读

热门阅读

  1. 触摸芯片在物联网和人工智能上的应用

    2024-06-13 07:02:04       6 阅读
  2. 排序

    排序

    2024-06-13 07:02:04      7 阅读
  3. c++【入门】小明买水果

    2024-06-13 07:02:04       6 阅读
  4. Hugging Face Hub 使用DuckDB进行分析

    2024-06-13 07:02:04       7 阅读
  5. mysql的双机热备

    2024-06-13 07:02:04       7 阅读
  6. Redis 分布式锁过期了,还没处理完怎么办?

    2024-06-13 07:02:04       6 阅读
  7. 远程工具向日葵的安装

    2024-06-13 07:02:04       5 阅读
  8. python scrapy爬虫学习

    2024-06-13 07:02:04       4 阅读
  9. Conda应用

    2024-06-13 07:02:04       3 阅读