Thursday, 30 March 2017

// // Leave a Comment

Delete Unassigned Shards Indexes | Elasticsearch

Bash Script To Delete Unassigned Shards Indexex



#!/bin/bash
IFS=$'\n'
for line in $(curl -s 'localhost:9200/_cat/shards' | fgrep UNASSIGNED); do
 INDEX=$(echo $line | (awk '{print $1}'))
 SHARD=$(echo $line | (awk '{print $2}'))
 #echo $INDEX
 curl -XDELETE localhost:9200/$INDEX
done

0 comments:

Post a Comment