Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all available indices via Java API [closed]

How to get a list of all available indices via the Java API?

With REST it's just the following HTTP-Request:

http://XXX.XXX.XXX.XXX:9200/_aliases

But for consistency it would be nice to do this via the Java API.

like image 666
Basti Funck Avatar asked Aug 01 '14 10:08

Basti Funck


1 Answers

The equivalent using the Java API and the elasticsearch org.elasticsearch.client.Client class is:

 client.admin().cluster()
    .prepareState().execute()
    .actionGet().getState()
    .getMetaData().aliases();
like image 102
Dan Tuffery Avatar answered Nov 03 '22 09:11

Dan Tuffery