参考文档:https://www.cnblogs.com/Dev0ps/p/9493576.html

  elasticsearch使用时间久了会产生大量索引占用磁盘空间,可以删除索引来释放  

  查看当前所有索引

curl '192.168.1.4:9200/_cat/indices?v'

  1,删除指定索引

curl -XDELETE 192.168.1.4:9200/system-log-2019.05

  其中system-log-2019.05为索引全称

  2,删除多个索引

curl -XDELETE 192.168.1.4:9200/system-log-2019.05,system-log-2019.05

  3,删除所有索引

 curl -XDELETE 192.168.1.4:9200/_all
或者
curl -XDELETE 192.168.1.4:9200/*

   通常不建议使用通配符,误删了后果就很严重了,所有的index都被删除了
    禁止通配符为了安全起见,可以在elasticsearch.yml配置文件中设置禁用_all和*通配符
      action.destructive_requires_name = true
      这样就不能使用_all和*了

  4,安装指定日期删除索引

  前提索引大多是以日期为结尾一般格式为*.2019.05.30或者*.2019.05如下所示

  书写删除索引脚本

delete_es_index.sh

  

#!/bin/bash
#此脚本删除90天以上的es索引
#d_time为找出索引结尾为2019.03.01格式索引
d_time=$(date -d '-90days' +'%Y.%m.%d')
#m_time为找出索引结尾为2019.03的格式索引
m_time=$(date -d '-90days' +'%Y.%m') /usr/bin/curl -XDELETE http://192.168.90.24:9200/*-${d_time}
/usr/bin/curl -XDELETE http://192.168.90.24:9200/*-${m_time}

  添加入定时任务每日执行即可

ELK之elasticsearch删除索引的更多相关文章

  1. elasticsearch删除索引报错【原】

    如果elasticsearch删除索引报错 curl -X DELETE 'http://10.73.26.66:9200/httpd-34-2017.08.15' {"error" ...

  2. ELK 脚本自动化删除索引

    kibana有自带接口,可通过自带的API接口 通过传参来达到删除索引的目的. # 删除15天前的索引 curl -XDELETE "http://10.228.81.161:9201/pa ...

  3. Elasticsearch 删除索引下的所有数据

    下面是head中操作的截图 #清空索引 POST quality_control/my_type/_delete_by_query?refresh&slices=5&pretty { ...

  4. ElasticSearch删除索引

    curl -X DELETE http://{ES IP address}:9200/{index_name}

  5. Elasticsearch 使用集群 - 删除索引

    章节 Elasticsearch 基本概念 Elasticsearch 安装 Elasticsearch 使用集群 Elasticsearch 健康检查 Elasticsearch 列出索引 Elas ...

  6. Elasticsearch 删除文档

    章节 Elasticsearch 基本概念 Elasticsearch 安装 Elasticsearch 使用集群 Elasticsearch 健康检查 Elasticsearch 列出索引 Elas ...

  7. 在 ELK Docker 容器中查看,删除索引

    使用 Docker 搭建好 ELK ( https://www.cnblogs.com/klvchen/p/9268510.html ) 环境后,如需查看 elasticsearch 的索引可采取以下 ...

  8. ELK批量删除索引 及 相关操作命令 - 运维小结

    线上部署了ELK+Redis日志分析平台环境, 随着各类日志数据源源不断的收集, 发现过了一段时间之后, ELK查看会原来越慢, 重启elasticsearch服务器节点之前同步时间也会很长,  这是 ...

  9. ELK批量删除索引

    一.存在问题 用了一段时间elk发现如果索引长时间不删除,elk会越来越慢,重启elasticsearch服务器节点之前同步时间也会很长 二.解决方法(定期删除索引) 1.在elasticsearch ...

随机推荐

  1. Vue之nextTick()

    我们有时候操作 DOM,是想在 data 数据变更的时候进行操作. 那么,我们应该怎么做呢? index.html <!DOCTYPE html> <html lang=" ...

  2. HTML 009 CSS

    HTML 样式- CSS CSS (Cascading Style Sheets) 用于渲染HTML元素标签的样式.     Look! Styles and colors Manipulate Te ...

  3. 获取登录用户ip

    public static String getIpAddr(HttpServletRequest request) { String ipAddress = null; try { ipAddres ...

  4. Laravel Model updating&updated 事件使用注意事项

    1 触发条件 1.1 updating 1.1.1 如果字段无变化,不会触发此事件. 1.1.2 除非更改至少一个字段的值 2 事件逻辑不会覆盖 2.1 Trait 中定义事件如下 /** * The ...

  5. Linq找不到行或行已更改

    1.发生这种情况第一时间是确认了database明明存在这条数据 2.然后确认了Linq查找的条件中是否有连接条件使得连续更新中发生变化 3.最后发现原来是Linq使用的表实际中有个field由not ...

  6. P4163 [SCOI2007]排列——next_permutation

    P4163 [SCOI2007]排列 注意要排序: next_permutation prev_permutation #include<cstdio> #include<cstri ...

  7. 【00NOIP提高组】单词接龙

    #include<bits/stdc++.h> using namespace std; ; int n,length; int vis[N]; string str[N]; inline ...

  8. 3、Web server 之httpd2.2 配置说明

    http协议实现的程序 静态(httpd, nginx, lighttpd) 动态 (IIS, tomcat,  jetty,  jboss,  resin,  websphere, weblogic ...

  9. Linux用户组

    1.介绍 类似于角色,系统可以对有共性的多个用户进行统一的管理 2.增加组 groupadd  组名 3.删除组 groupdel  组名 4.增加用户时直接为用户指定组 useradd  -g  用 ...

  10. Mac 下反编译Android APK

    准备工作:安装ApkTool.dex2jar.JD-GUI 安装ApkTool 1.下载ApkTool.大家可以从 https://ibotpeaches.github.io/Apktool/inst ...