How to get a list of all indexes in python-elasticsearch
Here is one way to do it with the get_alias()
method:
>>> indices=es.indices.get_alias().keys()
>>> sorted(indices)
[u'avails', u'hey', u'kibana-int']
This question comes up when searching for information on retrieving aliases
using the python-elasticsearch
library. The accepted answer says to use get_aliases
but that method has been removed (as of 2017). To get aliases
, you can use the following:
es.indices.get_alias("*")
how to get a list of all indexes in this cluster?
Use the wildcard. Works with elasticsearch-py.
for index in es.indices.get('*'):
print index