Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save portante/f02ba704fe0dec28e7700792ce32eb1d to your computer and use it in GitHub Desktop.

Select an option

Save portante/f02ba704fe0dec28e7700792ce32eb1d to your computer and use it in GitHub Desktop.
Simple sdcrip
#!/usr/bin/env python
# Use via: curl -X GET http://localhost:9200/_cluster/health?level=indices
import sys, json
#json_doc = json.load(open(sys.argv[1]))
json_doc = json.load(sys.stdin)
#json.dump(json_doc, sys.stdout, indent=4, sort_keys=True)
indices = json_doc['indices']
for idx,v in indices.iteritems():
print("%s: primaries: %s, replicas: %s, unassigned: %s" % (idx, v['number_of_replicas'], v['number_of_shards'], v['unassigned_shards']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment