curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-2018.08.09
{"acknowledged":true}
curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-2018.08.09,acc-apply-2018.08.10
curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-*
{"acknowledged":true}
curl -XDELETE http://localhost:9200/_all
或 curl -XDELETE http://localhost:9200/*
_all ,* 通配所有的索引
通常不建议使用通配符,误删了后果就很严重了,所有的index都被删除了
禁止通配符为了安全起见,可以在elasticsearch.yml配置文件中设置禁用_all和*通配符
action.destructive_requires_name = true
这样就不能使用_all和*了
curl -u elastic:changeme 'localhost:9200/_cat/indices?v'
30 2 * * * /usr/bin/curl -XDELETE -u elastic:changeme http://localhost:9200/*-$(date -d '-3days' +'%Y.%m.%d') >/dev/null 2>&1
#!/bin/bash
time=$(date -d '-3days' +'%Y.%m.%d')
curl -XDELETE -u elastic:changeme http://localhost:9200/*-${time}