Get index by alias with python api


(Hrdxwandg) #1

how to get actual index name by index alias name with elasticsearch-py or elasticsearch-dsl-py
the version of es is 6.2.4

for your help! thank you ahead!


(Hrdxwandg) #2

up,up


(David Pilato) #3

Read this and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.


(Lars) #4

It's easy as that:

if es.indices.exists_alias("test-alias"):    
     print(list(es.indices.get("test-alias").keys())[0])

(Hrdxwandg) #5

ok,thanks


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.