From 202f439baf1eaa7b06638eb566e275a7c01df90a Mon Sep 17 00:00:00 2001 From: Boris HUISGEN Date: Wed, 20 Jan 2016 12:14:25 +0100 Subject: [PATCH] Remove open and closed indices Signed-off-by: Boris HUISGEN --- elasticsearch-remove-old-indices.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch-remove-old-indices.sh b/elasticsearch-remove-old-indices.sh index 162297f..ef9832f 100755 --- a/elasticsearch-remove-old-indices.sh +++ b/elasticsearch-remove-old-indices.sh @@ -95,7 +95,7 @@ if [ -n "$ERROR" ]; then fi # Get the indices from elasticsearch -INDICES_TEXT=`curl -s "$ELASTICSEARCH/_status?pretty=true" | grep $GREP | grep -v \"index\" | sort -r | awk -F\" {'print $2'}` +INDICES_TEXT=`curl -s "$ELASTICSEARCH/_cat/indices?v" | awk '/'$GREP'/{match($0, /[:blank]*('$GREP'.[^ ]+)[:blank]*/, m); print m[1];}' | sort -r` if [ -z "$INDICES_TEXT" ]; then echo "No indices returned containing '$GREP' from $ELASTICSEARCH."