We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84b3cf2 commit 6ae5985Copy full SHA for 6ae5985
deleteOldIndices.sh
@@ -0,0 +1,14 @@
1
+#!/bin/bash
2
+set -euxo pipefail
3
+
4
+# Delete matching non-aliased indices, but keep the newest
5
6
+indices=("gnd-rppd*" "resources-rpb*")
7
+for index in "${indices[@]}"
8
+do
9
+ curl -s -S -X GET "localhost:9200/_cluster/state?filter_path=metadata.indices.$index.aliases&pretty" |
10
+ jq -r '.metadata.indices | to_entries[] | select(.value.aliases | length == 0) | .key' | # no alias
11
+ sort | head -n -1 | # don't include the newest index
12
+ awk '{print "localhost:9200/"$1"?pretty"}' |
13
+ xargs -L 1 curl -s -S -v -X DELETE
14
+done
0 commit comments