Get index by alias java api

how to get actual index name by index alias name with java api.
the version of es is 2.4.0

for your help! thank you ahead!

I had a quick look and couldn't see a specific API for this.
You could always run a search with size 1 and the physical index name should be returned as part of matching documents' properties.

My code is:

		// get name of the current index where the alias is active
		GetAliasesResponse r = client.admin().indices().getAliases(new GetAliasesRequest().aliases("YOUR_ALIAS")).get();

		for(Iterator<String> it = r.getAliases().keysIt(); it.hasNext();) {
			String realIndexName =;

thanks for your reply.

you can check xavierfacq's answer. I test the code ,and it's OK

thank you very much. it's OK

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