# Using aliases to search with java client

**URL:** <https://discuss.elastic.co/t/using-aliases-to-search-with-java-client/6469>\
**Category:** Elasticsearch\
**Created:** [January 23, 2012, 4:28pm UTC](https://discuss.elastic.co/t/using-aliases-to-search-with-java-client/6469 "2012-01-23T16:28:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danpolites](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danpolites/32/2136_2.png) [@danpolites](https://discuss.elastic.co/u/danpolites)\
**Post date:** [January 23, 2012, 4:28pm UTC](https://discuss.elastic.co/t/using-aliases-to-search-with-java-client/6469/1 "2012-01-23T16:28:17Z")

</div>

I'm working on refactoring our application to use filtered aliases  
instead of separate indices to handle multi-tenancy. I've got the api  
working to create and remove indices, but I haven't figured out how to  
actually specify the alias when I build a SearchRequest. Where do you  
specify the alias when searching with the Java client? Also will  
additional filters wipe out the filters in the alias?

---

<div class="post-metadata">

**Author:** ![danpolites](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danpolites/32/2136_2.png) [@danpolites](https://discuss.elastic.co/u/danpolites)\
**Post date:** [January 23, 2012, 4:31pm UTC](https://discuss.elastic.co/t/using-aliases-to-search-with-java-client/6469/2 "2012-01-23T16:31:45Z")

</div>

It just dawned on me that the alias name is more than likely used in  
place of the index name in the docs. Is this correct?

---

<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 23, 2012, 7:34pm UTC](https://discuss.elastic.co/t/using-aliases-to-search-with-java-client/6469/3 "2012-01-23T19:34:18Z")

</div>

Yep.

On Mon, Jan 23, 2012 at 6:31 PM, danpolites [dpolites@gmail.com](mailto:dpolites@gmail.com) wrote:

> It just dawned on me that the alias name is more than likely used in  
> place of the index name in the docs. Is this correct?

---

<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/using-aliases-to-search-with-java-client/6469/4 "2017-07-06T03:41:48Z")

</div>


