ELK.commands1
curl 127.0.0.1:9200/_cluster/health?pretty
curl 127.0.0.1:9200/_cat/indices?v
#get names of all indicies in red status
curl 127.0.0.1:9200/_cluster/health/?level=shards | jq -r '.indices | to_entries | map(select(.value.status == "yellow")) | .[].key'
#get jsons of all indicies in red status
curl 127.0.0.1:9200/_cluster/health/?level=shards | jq -r '.indices | to_entries | map(select(.value.status == "yellow")) | .[].key'
# prepare cmd for delete indicies in status yellow for 2021 year
curl 127.0.0.1:9200/_cluster/health/?level=shards | jq -r '.indices | to_entries | map(select(.value.status == "yellow")) | map(select(.key | test("2021"))) | .[].key' | sed 's/^/curl -XDELETE 127.0.0.1:9200\//'