0

I know how to get an alias if any given an index name in ElasticSearch:

es.indices.get_alias(indexname)

Is there a way to go the other way around? Something like es.indices.get_index(aliasname)? I implemented a workaround using the es.indices.get_alias for now but I am just curious.

kee
  • 10,969
  • 24
  • 107
  • 168

1 Answers1

2

I couldn't find any API returning an alias given an index name. Like I said, I had a workaround in Python using Elasticsearch module:

def get_alias_behind_index(client, indexname):
    if client.indices.exists_alias(name=indexname):
        return (list(client.indices.get_alias(indexname).keys())[0])
    return None
kee
  • 10,969
  • 24
  • 107
  • 168