# Bug ES6 JAVA API: Elasticsearch returning all the indices while trying to get only those indices which are associated with specific alias

**URL:** https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914
**Category:** Elasticsearch
**Created:** [December 9, 2017, 3:20am UTC](https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914 "2017-12-09T03:20:54Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![antitech](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antitech/32/25243_2.png) [@antitech](https://discuss.elastic.co/u/antitech)
#### Post date: [December 9, 2017, 3:20am UTC](https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914/1 "2017-12-09T03:20:54Z")

</div>

I have recently upgraded application from Elastic search 5.3.1 to 6.0.

My requirement was to get all the indices which were associated with specific alias.

I used below mentioned snippet to fetch all indices associated with specific alias . This snippet is working fine in 5.3.1 and giving only those indices which are associated with that specific alias.

**GetAliasesResponse r = client.admin().indices().getAliases(new GetAliasesRequest("givenalias")).actionGet();**

But after ES 6.0 , the same snippet giving all the indices which are created in system .

Ideally it should only return those indices which are associated with given alias .Not others. This was working in Elastic search 5.3.1.

---

<div class="post-metadata">

### Author: ![antitech](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antitech/32/25243_2.png) [@antitech](https://discuss.elastic.co/u/antitech)
#### Post date: [December 10, 2017, 2:55pm UTC](https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914/2 "2017-12-10T14:55:31Z")

</div>

@dadoonet can u help me with this query. I have to search all the indices by specific aliasname.

GET /alias1/\_alias this is working fine on ES6.0.0 by java api that i mentioned is not giving the same.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 10, 2017, 3:38pm UTC](https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914/3 "2017-12-10T15:38:47Z")

</div>

Read [this](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and specifically the "Also be patient" part.

---

<div class="post-metadata">

### Author: ![antitech](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antitech/32/25243_2.png) [@antitech](https://discuss.elastic.co/u/antitech)
#### Post date: [December 11, 2017, 4:56am UTC](https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914/4 "2017-12-11T04:56:10Z")

</div>

Thanks @dadoonet.

@jasontedor

[https://github.com/elastic/elasticsearch/commit/5b2ab96364335539affe99151546552423700f6e](https://github.com/elastic/elasticsearch/commit/5b2ab96364335539affe99151546552423700f6e) can be a cause.

> <https://stackoverflow.com/questions/47725065/resulting-all-the-indices-while-trying-to-get-only-those-indices-which-are-assoc>

---

<div class="post-metadata">

### Author: ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)
#### Post date: [December 11, 2017, 9:15pm UTC](https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914/5 "2017-12-11T21:15:33Z")

</div>

Personally I think this is a bug, it is certainly an unintended breaking change. I opened [#27763](https://github.com/elastic/elasticsearch/issues/27763) for discussion.

---

<div class="post-metadata">

### Author: ![antitech](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antitech/32/25243_2.png) [@antitech](https://discuss.elastic.co/u/antitech)
#### Post date: [December 12, 2017, 11:39am UTC](https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914/6 "2017-12-12T11:39:19Z")

</div>

Thanks @jasontedor . I 'll be watcher there.

---

<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: [January 9, 2018, 11:39am UTC](https://discuss.elastic.co/t/bug-es6-java-api-elasticsearch-returning-all-the-indices-while-trying-to-get-only-those-indices-which-are-associated-with-specific-alias/110914/7 "2018-01-09T11:39:26Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
