Is there a way to reproduce localhost:9200/_aliases using the java api?

Our system often needs to request the list of indices available (our 
indices are organized by date) to identify which days in the query date 
range have a corresponding index.  We are trying to avoid having to cache 
the list since it may change as our content retention policy cleans up 
indices.

I can retrieve the indices using the following java api call (equivalent of 
curl localhost:9200/_cluster/state):

client.admin().cluster().prepareState().execute().actionGet().getState().metaData()


However on our cluster, this call can take up to 80ms, while the curl get 
request for aliases comes back in 15ms.  Obviously, we would prefer to use 
the latter since the response time is compounded with the search time.  I 
just can't seem to find a way to get that list using java.

I've tried this, but the ImmutableOpenMap always comes back empty:

ImmutableOpenMap<String, List<AliasMetaData>> aliases = 
client.admin().indices().getAliases(new 
IndicesGetAliasesRequest()).actionGet().getAliases();


Any suggestions? 

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/f91edcaf-5ce9-4d92-9aa0-61bd530a21d4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to