# Adding mutliple types to an index

**URL:** <https://discuss.elastic.co/t/adding-mutliple-types-to-an-index/15038>\
**Category:** Elasticsearch\
**Created:** [December 27, 2013, 10:22pm UTC](https://discuss.elastic.co/t/adding-mutliple-types-to-an-index/15038 "2013-12-27T22:22:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsp/32/73057_2.png) [@jsp](https://discuss.elastic.co/u/jsp)\
**Post date:** [December 27, 2013, 10:22pm UTC](https://discuss.elastic.co/t/adding-mutliple-types-to-an-index/15038/1 "2013-12-27T22:22:04Z")

</div>

Hi,  
I have recently started playing with ES for a site search project. My  
search query runs against multiple tables across two databases, masterDb &  
clientDb. So my plan is to create two indexes one for each database and  
then add multiple types to each index.  
And then finally query across those indexes for result.

Can anyone comment is this approach correct? And secondly how can i query  
across indexes & types that I have created to get my results back? Any link  
to a tutorial would be great  
thanks  
j

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/be076eb2-7886-4d92-832e-a026260effc8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/be076eb2-7886-4d92-832e-a026260effc8%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Karol\_Gwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karol_gwaj/32/1324_2.png) [@Karol\_Gwaj](https://discuss.elastic.co/u/Karol_Gwaj)\
**Post date:** [December 27, 2013, 11:34pm UTC](https://discuss.elastic.co/t/adding-mutliple-types-to-an-index/15038/2 "2013-12-27T23:34:33Z")

</div>

here is tutorial about multi index/type search:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

as to how to organize your data, it is really hard to say  
it all depends of the size of your databases and the type of documents you  
want to index, from the top of my head:

- if your documents are hierarchically related (parent-child) then they  
have to go to this same index
- if you run your queries only against subset of tables (different query  
different subset), then consider grouping them into different indexes (or  
use routing)
- if you run your query always against all tables, then you can even put  
everything in one index with many shards (as there is really no much  
difference between running query on one index with multiple shards and  
running query on multiple indexes)

check this articles as starting point to learn more:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

[http://exploringelasticsearch.com/book/under-the-hood/clustering-and-index-internals.html](http://exploringelasticsearch.com/book/under-the-hood/clustering-and-index-internals.html)

Cheers,

On Friday, December 27, 2013 10:22:04 PM UTC, jsp wrote:

> Hi,  
> I have recently started playing with ES for a site search project. My  
> search query runs against multiple tables across two databases, masterDb &  
> clientDb. So my plan is to create two indexes one for each database and  
> then add multiple types to each index.  
> And then finally query across those indexes for result.
> 
> Can anyone comment is this approach correct? And secondly how can i query  
> across indexes & types that I have created to get my results back? Any link  
> to a tutorial would be great  
> thanks  
> j

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bb2ac8e0-bcdc-4754-9eed-1fb422932ba7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bb2ac8e0-bcdc-4754-9eed-1fb422932ba7%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:59am UTC](https://discuss.elastic.co/t/adding-mutliple-types-to-an-index/15038/3 "2017-07-06T01:59:12Z")

</div>


