In java,how do you query an index by alias

In JAVA, if the alias of the index my-index is my-alias, how do I query my-index based on my-alias
That is, how do you query an index by alias
Is it the following?

GetAliasesResponse a=esClient.admin().indices()
				.prepareGetAliases()
				.setAliases("my-alias")
				.get();

But the above code returns all indexes

I assume by "query my-index based on my-alias", you simply want to perform a search on "my-alias", in which case you just do exactly what you would do for an index, but use the alias name.

Largely speaking, you use aliases by passing them in anywhere where an index name is expected. (This is not true in every case, but is true for search and get).

Thank you,I didn't make it clear, I mean, how do I implement the following API in JAVA

GET /_alias/my-alias

Which Java client, and which version?

TransportClient 6.5

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