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>Curator 4 pulls much of the index metadata at IndexList initialization.  It's in bytes, rather than in human readable sizes, if that matters.  </p>

<p>It is in <strong>IndexList.index_info[index_name]['size_in_bytes']</strong></p>

<p>Read more about the IndexList method at <a href="http://curator.readthedocs.io/en/latest/objectclasses.html#indexlist" rel="nofollow">http://curator.readthedocs.io/en/latest/objectclasses.html#indexlist</a></p>

<pre><code>import elasticsearch
import curator
client = elasticsearch.Elasticsearch(host='127.0.0.1')

il = curator.IndexList(client)
print('{0}'.format(il.indices))
[u'topbeat-2016.09.01', ...]

print('{0}'.format(il.index_info['topbeat-2016.09.01'])
{'number_of_replicas': u'1', 'size_in_bytes': 706503044, 'number_of_shards': u'5', 'docs': 1629986, 'age': {'creation_date': 1472688002}, 'state': u'open', 'segments': 0}
</code></pre>

python api dictionary elasticsearch elasticsearch-curator