Are documents of different types indexed via one index?


(Александр Свиридов) #1

From ES document I understood that index is like database and document type is like table. Every table has its own indexes.

Let's suppose we have one ES index with two document types (posts and book) and we have 1000000000 posts and 30 books. If I search for some text expression in ONLY books will my query be very fast or slow? By other words - documents of different types are indexed via one index or for every document type separate index is created?

--
Александр Свиридов

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426882118.273423714%40f319.i.mail.ru.
For more options, visit https://groups.google.com/d/optout.


(Mark Walkom) #2

You can mix types in a single index, but we recommend you separate them out.

Obviously a search against 30 docs is a lot faster than one against 1
billion.

On 20 March 2015 at 13:08, Александр Свиридов ooo_saturn7@mail.ru wrote:

From ES document I understood that index is like database and document
type is like table. Every table has its own indexes.

Let's suppose we have one ES index with two document types (posts and
book) and we have 1000000000 posts and 30 books. If I search for some text
expression in ONLY books will my query be very fast or slow? By other
words - documents of different types are indexed via one index or for every
document type separate index is created?

--
Александр Свиридов

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/1426882118.273423714%40f319.i.mail.ru
https://groups.google.com/d/msgid/elasticsearch/1426882118.273423714%40f319.i.mail.ru?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAEYi1X9JTafPbhBBeL4GLj3Bs_wenZsRP5DnutQVu0gU%3DdypLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Александр Свиридов) #3

So, as I understand you ritgh all documents of all types in one index indexed together. Not as in databases - one table (ome type) - one index.

Пятница, 20 марта 2015, 14:19 -07:00 от Mark Walkom markwalkom@gmail.com:

You can mix types in a single index, but we recommend you separate them out.

Obviously a search against 30 docs is a lot faster than one against 1 billion.

On 20 March 2015 at 13:08, Александр Свиридов < ooo_saturn7@mail.ru > wrote:

From ES document I understood that index is like database and document type is like table. Every table has its own indexes.

Let's suppose we have one ES index with two document types (posts and book) and we have 1000000000 posts and 30 books. If I search for some text expression in ONLY books will my query be very fast or slow? By other words - documents of different types are indexed via one index or for every document type separate index is created?

--
Александр Свиридов

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 .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426882118.273423714%40f319.i.mail.ru .
For more options, visit https://groups.google.com/d/optout .

--
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 .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAEYi1X9JTafPbhBBeL4GLj3Bs_wenZsRP5DnutQVu0gU%3DdypLQ%40mail.gmail.com .
For more options, visit https://groups.google.com/d/optout .

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1426887424.631597516%40f411.i.mail.ru.
For more options, visit https://groups.google.com/d/optout.


#4

Could you please elaborate on this, or point towards a resource that explains this better? Thanks.


(Nik Everett) #5

How about https://www.elastic.co/blog/index-vs-type ?


#6

Thanks, I find this to be useful context. However, I don't find a direct explanation for the reasons why separate indices are preferred over a single index with multiple types.

There are some data modeling implications that are mentioned (field name, storage of sparse fields, scoring). This to me suggests there may be times where the index + types model is useful (and your cited article says as much).

My reading of the above statement recommends that multiple types not be present in an index, suggesting that the index + types model may not be so useful, more or less in the form: "Don't mix types in a single index because $badthing."

Thanks again for your response.


(system) #7