Multiple types vs Multiple indexes


(y_itay) #1

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.
For more options, visit https://groups.google.com/groups/opt_out.


(depahelix) #2

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
Sent: Monday, October 07, 2013 9:30 AM
To: "depahelix" 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.


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
ndexes-tp4042221.html To start a new topic under ElasticSearch Users,
email ml-node+s115913n115913h8@n3.nabble.com
To unsubscribe from ElasticSearch Users, click here.
NAML


(Ivan Brusic) #3

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 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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4