ES一些常见使用命令

 -X :指定http的请求方式,有HEAD、GET、POST、PUT、DELETE
 -d :指定要传输的数据
 -H :指定http的请求头信息

1.查询es 下的所有索引:

curl -u 用户名:密码 http://ip:port/_cat/indices

  查看单个索引信息

curl -XGET -u 用户名:密码  http://ip:port/索引名?pretty  

---查询数据
curl -H "Content-Type:application/json" -u 用户名:密码 -XGET http://ip:port/索引名/_search?pretty -d '{"query":{"match_all":{}} }'

2.查看集群是否正常 :

curl -u 用户名:密码 http://ip:port/_cat/health?v

 

3.删除所有数据,不删除索引结构:

 

   curl -XPOST "http://ip:port/索引名/_delete_by_query?pretty=true" -d'{  "query": {    "match_all": {}  }}'

  curl -u 用户名:密码 -XPOST 'ip:port/索引名/_delete_by_query?refresh&slices=5&pretty' -H 'Content-Type: application/json' -d'{  "query": {    "match_all": {}  }}'

4.删除所有数据,含索引结构

curl -X DELETE http://ip:port/索引名

 

参考:https://blog.csdn.net/wangqinyi574110/article/details/107900826

https://blog.csdn.net/liqfyiyi/article/details/120849116

posted @   ni当像鸟飞往你的山  阅读(540)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示