How to do _cat/indices/<index_name_with_reg_ex> in JAVA

I have some indexes with name test-1-in, test-2-in, test-3-in. I want to do _cat/indices/test-*-in from JAVA API. How to do this?

You can't call cat API from transport client. It's a REST API only.

But you can look at the source code to see how it's implemented behind the scene and do the same thing from the transport client.

Thanks @dadoonet. I dug into _cat implementation and found out what they are doing. Here it is:

final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
final IndicesOptions strictExpandIndicesOptions = IndicesOptions.strictExpand();
ClusterStateResponse clusterStateResponse = client.admin().cluster().state(clusterStateRequest).get(); 

This will give all indexes. After that the reg ex matching has to be done manually.

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