Elasticsearch find all indexes using the Java client
This also works for Elasticsearch 6.2.3 and java API-client 6.2.3:
String[] indices = client.admin().indices().prepareGetIndex().setFeatures().get().getIndices();
It's definitely possible but it's unfortunately not documented in the official documentation for the Java client. You can achieve this with:
List<IndexMetaData> indices = client.admin().cluster()
.prepareState().get().getState()
.getMetaData().getIndices();
Elasticsearch 6.5, RestHighLevelClient:
ClusterHealthRequest request = new ClusterHealthRequest();
ClusterHealthResponse response = client.cluster().health(request, RequestOptions.DEFAULT);
Set<String> indices = response.getIndices().keySet();
Another way I found to do this:
client.admin()
.indices()
.getIndex(new GetIndexRequest())
.actionGet()
.getIndices()