I am in the process of migrating an app from the TransportClient
to the RestHighLevelClient
. Right now I have the following method for getting the index metadata:
public IndexMetaData getIndexMetaData(String indexAlias) {
ClusterState state = transportClient.admin().cluster().prepareState()
.setIndices(new String[]{indexAlias})
.execute()
.actionGet()
.getState();
Set<String> indices = getIndicesByAlias(indexAlias);
if (indices.size() > 0) {
return state.metaData().index(indices.iterator().next());
}
else {
return null;
}
}
Based on https://github.com/elastic/elasticsearch/issues/27205, the RestHighLevelClient
does not have support for getting the cluster state.
How can I replace the above method by using the RestHighLevelClient
?