Last active
April 13, 2017 19:31
-
-
Save portante/da36a5a13c570c19489416e6fca80b4b to your computer and use it in GitHub Desktop.
Simple python script to process stdin from include settings API to dump number of primary shards and replica counts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Use via: curl -X GET http://localhost:9200/_all/_settings?pretty | |
| 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) | |
| for idx,v in json_doc.iteritems(): | |
| settings = v['settings']['index'] | |
| print("%s: primaries: %s, replicas: %s, unassigned: %s" % (idx, settings['number_of_replicas'], settings['number_of_shards'], settings['unassigned_shards'])) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: