How would I get a list of the names of an index in Python? Here is what I have so far:
>>> es=e.es >>> es <Elasticsearch([{'host': '14555f777d8097.us-east-1.aws.found.io', 'port': 9200}])> >>> es.indices <elasticsearch.client.indices.IndicesClient object at 0x10de86790> # how to get a list of all indexes in this cluster?
There are multiple ways to list all of the indexes contained in an Elasticsearch cluster. One common way of doing this is to use cURL and Kibana to issue HTTP requests to communicate with the Elasticsearch cluster to have it return all of the index names and their respective UUIDs.
By default, Elasticsearch indexes all data in every field and each indexed field has a dedicated, optimized data structure. For example, text fields are stored in inverted indices, and numeric and geo fields are stored in BKD trees.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With