删除elasticsearch数据

删除elasticsearch数据分为两种:一种是删除索引(数据和表结构同时删除,作用同sql server 中 drop table "表格名"),另一种是删除数据(不删除表结构,作用同 sql server中delete 语句)

1、查询索引

curl -XGET http://127.0.0.1:9201/_cat/indices?v

curl -u user:passwd  -XGET http://127.0.0.1:9201/_cat/indices?v
curl -XGET 'http://127.0.0.1:9201/_cat/indices' |awk '{print $3}' | awk -F'-' '{print $1}' |sort |uniq -c

得出占空间较大的索引的名称:

sw_log-20240609
sw_log-20240608
sw_log-20240607
sw_segment-20240610
sw_segment-20240611
sw_segment-20240609
sw_segment-20240608
sw_segment-20240607
sw_segment-20240606

2、手工删除
curl -XDELETE http://127.0.0.1:9201/sw_log-20240607
curl -XDELETE http://127.0.0.1:9201/sw_log-20240608
curl -XDELETE http://127.0.0.1:9201/sw_log-20240609

curl -XDELETE http://127.0.0.1:9201/sw_segment-20240606
curl -XDELETE http://127.0.0.1:9201/sw_segment-20240607
curl -XDELETE http://127.0.0.1:9201/sw_segment-20240608
curl -XDELETE http://127.0.0.1:9201/sw_segment-20240609
curl -XDELETE http://127.0.0.1:9201/sw_segment-20240610
curl -XDELETE http://127.0.0.1:9201/sw_segment-20240611

posted @   walkersss  阅读(638)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· DeepSeek “源神”启动!「GitHub 热点速览」
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
历史上的今天:
2023-06-12 OutOfMemoryError: GC overhead limit exceeded
2023-06-12 Jconsole使用
点击右上角即可分享
微信分享提示