# Multiple types vs Multiple indexes

**URL:** <https://discuss.elastic.co/t/multiple-types-vs-multiple-indexes/13868>\
**Category:** Elasticsearch\
**Created:** [October 7, 2013, 1:29pm UTC](https://discuss.elastic.co/t/multiple-types-vs-multiple-indexes/13868 "2013-10-07T13:29:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![y\_itay](https://avatars.discourse-cdn.com/v4/letter/y/76d3ee/32.png) [@y\_itay](https://discuss.elastic.co/u/y_itay)\
**Post date:** [October 7, 2013, 1:29pm UTC](https://discuss.elastic.co/t/multiple-types-vs-multiple-indexes/13868/1 "2013-10-07T13:29:36Z")

</div>

Hey,

I am planning to use elasticsearch for my website and I need to index 3  
different types of entities.  
It's something like: users/tweets/tags  
Would it be better to create 3 different indexes or create 1 index with 3  
types?  
I'm going to need the ability to search across users/tweet and tags at the  
same time.  
I know it's possible to use multi search if I have 3 indexes or if if I  
have 1 index and 3 types, you just specify the types in the query.  
The only issue I'm seeing with 3 types is that I would like to be able to  
get 3 results of each entity.  
Is this possible? what will be the best practice?

Thanks!

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![depahelix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/depahelix/32/2066_2.png) [@depahelix](https://discuss.elastic.co/u/depahelix)\
**Post date:** [October 7, 2013, 6:22pm UTC](https://discuss.elastic.co/t/multiple-types-vs-multiple-indexes/13868/2 "2013-10-07T18:22:24Z")

</div>

Up vote on the question.

I don't know the right answer to this, either.

I am new but I went to ES training.

My guess would be that you could have 1 index, and have the users be  
parents of tweets (see parent/child relationships / routing), then have  
tags be a single array property within each tweet.

You'll be able to do searches for tweets by user efficiently and facet on  
tags.

There have got to be other designs for this, though.

* * *

From: "y\_itay [via ElasticSearch Users]"  
[ml-node+s115913n4042221h56@n3.nabble.com](mailto:ml-node+s115913n4042221h56@n3.nabble.com)  
Sent: Monday, October 07, 2013 9:30 AM  
To: "depahelix" [chris@depahelix.com](mailto:chris@depahelix.com)  
Subject: Multiple types vs Multiple indexes

Hey,  
I am planning to use elasticsearch for my website and I need to index 3  
different types of entities. It's something like: users/tweets/tags Would  
it be better to create 3 different indexes or create 1 index with 3 types?  
I'm going to need the ability to search across users/tweet and tags at the  
same time. I know it's possible to use multi search if I have 3 indexes or  
if if I have 1 index and 3 types, you just specify the types in the query.  
The only issue I'm seeing with 3 types is that I would like to be able to  
get 3 results of each entity. Is this possible? what will be the best  
practice?  
Thanks!

--  
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 [hidden email].  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

* * *

If you reply to this email, your message will be added to the discussion  
below:  
[http://elasticsearch-users.115913.n3.nabble.com/Multiple-types-vs-Multiple-i](http://elasticsearch-users.115913.n3.nabble.com/Multiple-types-vs-Multiple-i)  
ndexes-tp4042221.html To start a new topic under ElasticSearch Users,  
email [ml-node+s115913n115913h8@n3.nabble.com](mailto:ml-node+s115913n115913h8@n3.nabble.com)  
To unsubscribe from ElasticSearch Users, click here.  
NAML

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [October 8, 2013, 7:07pm UTC](https://discuss.elastic.co/t/multiple-types-vs-multiple-indexes/13868/3 "2013-10-08T19:07:39Z")

</div>

Types essentially give you the ability to create different documents  
schemas. Ultimately, all the types reside in the same Lucene index.

If your volume changes dramatically between types, which I assume is your  
case, then I would suggest different indices. The number of tweets should  
be orders of magnitude higher than the number of users. With different  
indices, you can control the amount of shards and replicas. The smaller  
indices probably do not need to be sharded as much. Having different types  
in the same index removes this flexibility. YMMV, create lots of tests.

Cheers,

Ivan

On Mon, Oct 7, 2013 at 6:29 AM, itay yahimovitz [itay1336@gmail.com](mailto:itay1336@gmail.com) wrote:

> Hey,
> 
> I am planning to use elasticsearch for my website and I need to index 3  
> different types of entities.  
> It's something like: users/tweets/tags  
> Would it be better to create 3 different indexes or create 1 index with 3  
> types?  
> I'm going to need the ability to search across users/tweet and tags at the  
> same time.  
> I know it's possible to use multi search if I have 3 indexes or if if I  
> have 1 index and 3 types, you just specify the types in the query.  
> The only issue I'm seeing with 3 types is that I would like to be able to  
> get 3 results of each entity.  
> Is this possible? what will be the best practice?
> 
> Thanks!
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
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, 2:13am UTC](https://discuss.elastic.co/t/multiple-types-vs-multiple-indexes/13868/4 "2017-07-06T02:13:17Z")

</div>


