The easiest way to find out how to use the Java API equivalent of a REST
call is to simply look up the RestAction class. In this case:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetIndicesAliasesAction.java<https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetIndicesAliasesAction.java?source=c>

I am on version 0.90.2 and I have been using
client.admin().cluster().state(new
ClusterStateRequest()).actionGet().getState().getMetaData().aliases()
which should be equivalent to yours.

Cheers,

Ivan



On Mon, Jan 20, 2014 at 5:42 PM, Emilie Lavigne <[email protected]>wrote:

> 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.
>

-- 
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/CALY%3DcQDz0T0RL8qs7arGBrgy4FfiSGvbt2Q6jy2uDhMsixYorQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to