今天写下关于ES中常用的语句,便于以后在工作中便于查找
- 查看状态
curl -XGET http://ip:port/_cat/health?v
- 查看所有索引
curl -XGET http://ip:port/_cat/indices
- 删除索引
curl -XDELETE http://ip:port/xyz?pretty
- 查看master状态
curl -XGET http://ip:port/_cat/master?pretty
- 查看别名
curl -XGET http://ip:port/_alias
- ES数据定期删除
设置定时任务(每天1点执行)#/bin/bash #es-index-clear #只保留15天内的日志索引 LAST_DATA=`date -d "-15 days" "+%Y.%m.%d"` #删除上个月份所有的索引 curl -XDELETE 'http://ip:port/*-'${LAST_DATA}''
0 1 * * * /home/wasadm/scripts/es-index-clear.sh