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();
clusterStateRequest.clear().metaData(true);
final IndicesOptions strictExpandIndicesOptions = IndicesOptions.strictExpand();
clusterStateRequest.indicesOptions(strictExpandIndicesOptions);
ClusterStateResponse clusterStateResponse = client.admin().cluster().state(clusterStateRequest).get();
clusterStateResponse.getState().getMetadata().getIndices()
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.