# How to perform searching in same index name with different indices?

**URL:** <https://discuss.elastic.co/t/how-to-perform-searching-in-same-index-name-with-different-indices/4908>\
**Category:** Elasticsearch\
**Created:** [July 20, 2011, 12:46pm UTC](https://discuss.elastic.co/t/how-to-perform-searching-in-same-index-name-with-different-indices/4908 "2011-07-20T12:46:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)\
**Post date:** [July 20, 2011, 12:46pm UTC](https://discuss.elastic.co/t/how-to-perform-searching-in-same-index-name-with-different-indices/4908/1 "2011-07-20T12:46:45Z")

</div>

Hi All

I'm using elastic search-0.16.2 java lib and using Rabbitmq River to  
create index from json documents.i have created index person and with  
two different indices(personal\_details,location).i want know how i'm  
able to search data in same index with different indices.  
please help me?

Thanks

---

<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:** [July 20, 2011, 4:48pm UTC](https://discuss.elastic.co/t/how-to-perform-searching-in-same-index-name-with-different-indices/4908/2 "2011-07-20T16:48:48Z")

</div>

Not sure I understand the question. How can there be one index and two  
indices? Maybe you are mixing between an index and a type?

On Wed, Jul 20, 2011 at 3:46 PM, sam [mishra.sameek@gmail.com](mailto:mishra.sameek@gmail.com) wrote:

> Hi All
> 
> I'm using Elasticsearch-0.16.2 java lib and using Rabbitmq River to  
> create index from json documents.i have created index person and with  
> two different indices(personal\_details,location).i want know how i'm  
> able to search data in same index with different indices.  
> please help me?
> 
> Thanks

---

<div class="post-metadata">

**Author:** ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)\
**Post date:** [July 21, 2011, 5:23am UTC](https://discuss.elastic.co/t/how-to-perform-searching-in-same-index-name-with-different-indices/4908/3 "2011-07-21T05:23:23Z")

</div>

yes my mistake,I have confusion on indices and type.can we create same  
index with different type and perform searching on different type.if  
it is possible then how i 'm able to search data using java?

On Jul 20, 9:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Not sure I understand the question. How can there be one index and two  
> indices? Maybe you are mixing between an index and a type?
> 
> On Wed, Jul 20, 2011 at 3:46 PM, sam [mishra.sam...@gmail.com](mailto:mishra.sam...@gmail.com) wrote:
> 
> > Hi All
> 
> > I'm using Elasticsearch-0.16.2 java lib and using Rabbitmq River to  
> > create index from json documents.i have created index person and with  
> > two different indices(personal\_details,location).i want know how i'm  
> > able to search data in same index with different indices.  
> > please help me?
> 
> > Thanks

---

<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:** [July 21, 2011, 8:11am UTC](https://discuss.elastic.co/t/how-to-perform-searching-in-same-index-name-with-different-indices/4908/4 "2011-07-21T08:11:38Z")

</div>

You can set the types you want to search on on the  
SearchRequestBuilder#setTypes

On Thu, Jul 21, 2011 at 8:23 AM, sam [mishra.sameek@gmail.com](mailto:mishra.sameek@gmail.com) wrote:

> yes my mistake,I have confusion on indices and type.can we create same  
> index with different type and perform searching on different type.if  
> it is possible then how i 'm able to search data using java?
> 
> On Jul 20, 9:48 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Not sure I understand the question. How can there be one index and two  
> > indices? Maybe you are mixing between an index and a type?
> > 
> > On Wed, Jul 20, 2011 at 3:46 PM, sam [mishra.sam...@gmail.com](mailto:mishra.sam...@gmail.com) wrote:
> > 
> > > Hi All
> > 
> > > I'm using Elasticsearch-0.16.2 java lib and using Rabbitmq River to  
> > > create index from json documents.i have created index person and with  
> > > two different indices(personal\_details,location).i want know how i'm  
> > > able to search data in same index with different indices.  
> > > please help me?
> > 
> > > Thanks

---

<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:59am UTC](https://discuss.elastic.co/t/how-to-perform-searching-in-same-index-name-with-different-indices/4908/5 "2017-07-06T03:59:55Z")

</div>


