ElasticSearch 清理索引

查看索引

curl -XGET  "http://localhost:9200/_cat/indices?v"

删除自定义日志索引

#!/bin/bash
# 大于3天的索引
for ((i=3; i<=30; i ++))
do 
    echo $i
    LAST_DATA1=`date -d "-$i days" "+%Y.%m.%d"`
    LAST_DATA2=`date -d "-$i days" "+%Y%m%d"`
    curl -XDELETE  "http://127.0.0.1:9200/*-${LAST_DATA2}"
    curl -XDELETE  "http://127.0.0.1:9200/test*-${LAST_DATA1}"
done
原文地址:https://www.cnblogs.com/gooooodmorning/p/13611825.html