使用命令查看es所有索引
curl -X GET "http://10.10.10.10:9200/_cat/indices?v"
curl -u username:password -X GET "http://10.10.10.10:32201/_cat/indices?v" #指定用户名密码
删除单个索引
curl -X DELETE "http://10.10.10.10:9200/jira_story"
批量删除所有索引
#!/bin/bash
# Elasticsearch 地址
ES_HOST="http://10.10.10.10:9200"
# 获取所有索引
indices=$(curl -s $ES_HOST/_cat/indices?v | awk '{print $3}')
# 删除所有索引
for index in $indices
do
echo "Deleting index: $index"
curl -X DELETE "$ES_HOST/$index"
done
echo "All indices deleted."