if [ $t1 -le $t2 ]; then echo"$1时间早于$comp_date,进行索引删除" #转换一下格式,将类似2017-10-01格式转化为2017.10.01 format_date=`echo$1| sed 's/-/\./g'` curl -XDELETE http://${ES_IP}:${ES_PORT}/*$format_date fi }
curl -XGET http://${ES_IP}:${ES_PORT}/_cat/indices | awk -F" "'{print $3}' | awk -F"-"'{print $NF}' | egrep "[0-9]*\.[0-9]*\.[0-9]*" | sort | uniq | sed 's/\./-/g' | whileread LINE do #调用索引删除函数 delete_indices $LINE done