Elasticsearch (Elasticsearch Curator) Python API. Get dictionary of ES indices and their sizes
<p>I can get all of ES indexes in list via such code:</p>

<pre><code>from elasticsearch import Elasticsearch
es = Elasticsearch()

indices=es.indices.get_aliases().keys()
sorted(indices)
</code></pre>

<p>But is it possible to get dictionary like <code>{'index1': '100gb', 'index2': '10gb', 'index3': '15gb'}</code>. So i mean dic with index name and size of them.</p>

<p>My variant:</p>

<pre><code>import elasticsearch

client = elasticsearch.Elasticsearch()
all_indices = client.indices.stats(metric='store', human=True)['indices'].keys()
dic_indices = {}

for index in all_indices:
    size = client.indices.stats(metric='store', human=True)['indices'][index]['total']['store']['size']
    dic_indices[index] = size

print dic_indices
</code></pre>

<p>Result has next view:</p>

<pre><code>{u'haproxy-2016.09.02': u'1.6gb', u'haproxy-2016.09.03': u'827.3mb', u'marathon-2016.09.03': u'296.1mb', u'docker-2016-09-06': u'187.2mb', u'haproxy-2016.09.06': u'339.7mb', u'haproxy-2016.09.04': u'647.5mb', u'haproxy-2016.09.05': u'595.5mb'}
</code></pre>

python api dictionary elasticsearch elasticsearch-curator