Get list of aliases pointing to given index


(Hanish Bansal) #1

Hi All,

I am trying to get the list of all aliases pointing to given index.

Please suggest Java API for the same.

--
Thanks & Regards
Hanish Bansal

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

You can retrieve the list of aliases for an index from the cluster state.
There is a REST call to achieve the aliases, which does nothing more than
retrieve the cluster state and filter by index name. Look at
the RestGetIndicesAliasesAction class as an example. I usually would
suggest to look for a test, but I could not find a suitable test class.

http://IP:9200/indexname/_alias/*http://srch-dv109:9200/products-20130831-082113/_alias/*

http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/

Cheers,

Ivan

On Thu, Sep 5, 2013 at 6:09 AM, Hanish Bansal <
hanish.bansal.agarwal@gmail.com> wrote:

Hi All,

I am trying to get the list of all aliases pointing to given index.

Please suggest Java API for the same.

--
Thanks & Regards
Hanish Bansal

--
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 elasticsearch+unsubscribe@googlegroups.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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Hanish Bansal) #3

Thanks lvan

I am able to get aliases by looking at RestGetIndicesAliasesAction class.

Java API for the same is:

ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest()
.filterRoutingTable(true)
.filterNodes(true)
.filteredIndices(indexName);
Set setAliases=
client.admin().cluster().state(clusterStateRequest).actionGet().getState().getMetaData().aliases().keySet();

On Thu, Sep 5, 2013 at 11:46 PM, Ivan Brusic ivan@brusic.com wrote:

You can retrieve the list of aliases for an index from the cluster state.
There is a REST call to achieve the aliases, which does nothing more than
retrieve the cluster state and filter by index name. Look at
the RestGetIndicesAliasesAction class as an example. I usually would
suggest to look for a test, but I could not find a suitable test class.

http://IP:9200/indexname/_alias/*http://srch-dv109:9200/products-20130831-082113/_alias/*

http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/

Cheers,

Ivan

On Thu, Sep 5, 2013 at 6:09 AM, Hanish Bansal <
hanish.bansal.agarwal@gmail.com> wrote:

Hi All,

I am trying to get the list of all aliases pointing to given index.

Please suggest Java API for the same.

--
Thanks & Regards
Hanish Bansal

--
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 elasticsearch+unsubscribe@googlegroups.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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks & Regards
Hanish Bansal

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4