# Retrieving indexes attached to alias

**URL:** <https://discuss.elastic.co/t/retrieving-indexes-attached-to-alias/6453>\
**Category:** Elasticsearch\
**Created:** [January 20, 2012, 7:24pm UTC](https://discuss.elastic.co/t/retrieving-indexes-attached-to-alias/6453 "2012-01-20T19:24:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![james](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@james](https://discuss.elastic.co/u/james)\
**Post date:** [January 20, 2012, 7:24pm UTC](https://discuss.elastic.co/t/retrieving-indexes-attached-to-alias/6453/1 "2012-01-20T19:24:46Z")

</div>

How can I retrieve a list of existing indexes attached to an alias  
using the Java API?

I am executing a periodic bulk reindex of a legacy database. To  
minimize interruption the idea is to create a new timestamp named  
index, perform the bulk index, add the new index to the alias, remove  
the original index from the alias and delete the original index. I  
need a way to retrieve the name of the existing index as it will  
always be unique.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 20, 2012, 7:28pm UTC](https://discuss.elastic.co/t/retrieving-indexes-attached-to-alias/6453/2 "2012-01-20T19:28:28Z")

</div>

You can use the cluster state API to get it, here is how the REST get  
aliases endpot works:  
[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java#L59](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java#L59)  
.

On Fri, Jan 20, 2012 at 9:24 PM, JamesA [james@oslx.com](mailto:james@oslx.com) wrote:

> How can I retrieve a list of existing indexes attached to an alias  
> using the Java API?
> 
> I am executing a periodic bulk reindex of a legacy database. To  
> minimize interruption the idea is to create a new timestamp named  
> index, perform the bulk index, add the new index to the alias, remove  
> the original index from the alias and delete the original index. I  
> need a way to retrieve the name of the existing index as it will  
> always be unique.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:41am UTC](https://discuss.elastic.co/t/retrieving-indexes-attached-to-alias/6453/3 "2017-07-06T03:41:58Z")

</div>


