Is there an advantage in splitting the data structure in multiple _type(s) instead of using just one _type?


(joa) #1

Image the following:

I have three different types, e.g.: cars, boats, airplanes.
All of these types have similar fields like the name, color, prize, brand,
...
But they also differ in some fields like "maxAltitude".

Would it be better to use three different _type(s) or is it better to use
one _type with all fields? (When working with one _type I would add a
normal field "type" to distinguished)
What are the pros/cons?

Thanks, Joa

--
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.


(Adrien Grand) #2

Hi Joa,

On Thu, Oct 3, 2013 at 6:44 PM, joa joafeldmann@gmail.com wrote:

Would it be better to use three different _type(s) or is it better to use
one _type with all fields? (When working with one _type I would add a
normal field "type" to distinguished)
What are the pros/cons?

Both options you are mentioning are strictly equivalent. Just do what feels
more convenient to you.

--
Adrien Grand

--
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.


(joa) #3

Thanks Adrien!

On Friday, October 4, 2013 10:49:17 AM UTC+2, Adrien Grand wrote:

Hi Joa,

On Thu, Oct 3, 2013 at 6:44 PM, joa <joafe...@gmail.com <javascript:>>wrote:

Would it be better to use three different _type(s) or is it better to use
one _type with all fields? (When working with one _type I would add a
normal field "type" to distinguished)
What are the pros/cons?

Both options you are mentioning are strictly equivalent. Just do what
feels more convenient to you.

--
Adrien Grand

--
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.


(ddorian43) #4

There is a little difference, example you can have multiple types with the
same id. But if you have a type_field you can't do (automatically).

On Fri, Oct 4, 2013 at 11:06 AM, joa joafeldmann@gmail.com wrote:

Thanks Adrien!

On Friday, October 4, 2013 10:49:17 AM UTC+2, Adrien Grand wrote:

Hi Joa,

On Thu, Oct 3, 2013 at 6:44 PM, joa joafe...@gmail.com wrote:

Would it be better to use three different _type(s) or is it better to
use one _type with all fields? (When working with one _type I would add a
normal field "type" to distinguished)
What are the pros/cons?

Both options you are mentioning are strictly equivalent. Just do what
feels more convenient to you.

--
Adrien Grand

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/3TSTF4WVSHs/unsubscribe.
To unsubscribe from this group and all its topics, 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.


(joa) #5

Ok, right!
But there are no pro/cons when it comes to performance / sharding / scaling
out, cause this always goes down to the index?

--
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.


(ddorian43) #6

It's complicated.

Suppose that you are routing different types by user_id. If a user becomes
very big, his documents across diferent types will become big => the shard
will become hot.
If the document_types are across multiple indexes, (say, we have 4 types in
4 indexes), than 4 shards will become hot, and you can spread these 4
shards across nodes in the cluster, so the node will be less hot than the
previous example.

When searching(query), if the smaller the shard(less document types in
index) the faster it is and you won't have to filter on the type. (i'm not
sure about this)

On Fri, Oct 4, 2013 at 5:47 PM, joa joafeldmann@gmail.com wrote:

Ok, right!
But there are no pro/cons when it comes to performance / sharding /
scaling out, cause this always goes down to the index?

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/3TSTF4WVSHs/unsubscribe.
To unsubscribe from this group and all its topics, 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) #7