Skip to content

Instantly share code, notes, and snippets.

@mitallast
Last active August 5, 2016 10:03
Show Gist options
  • Select an option

  • Save mitallast/afaf372473c254b94038c7953fd44d83 to your computer and use it in GitHub Desktop.

Select an option

Save mitallast/afaf372473c254b94038c7953fd44d83 to your computer and use it in GitHub Desktop.
recovery.py index-name-1 index-name-2
from elasticsearch import Elasticsearch
import sys
indexes = sys.argv[1:]
client = Elasticsearch('host:port')
recovery = client.indices.recovery(",".join(indexes), human=True)
for index, state in recovery.items():
print "index: {}".format(index)
for shard in state['shards']:
print "shard: {:<2}".format(shard['id']),
print "size: {:<6}".format(shard['index']['size']['percent']),
print "files: {:<6}".format(shard['index']['files']['percent'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment