Understanding index vs mapping

Hi,

i am a bit confused and do not understand what is written here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/_basic_concepts.html#_index

First question:
Is "type" the same as a "mapping" ?

Second question:
The explanation by the examples for index and type sounds for me that i can exchange them from index to type and vice versa.
Index example: one index for customer data and one index for product data. But why not realize that with one index and two types ?

What is if i have category data and product data? Should i provide one index with two types or better two indices with one type per index?
--> by explanation i can use two inices, or one with two type.

That confuses me. For what is the subdivision index/type good for?

Kind regards
David

A type is like a table in SQL world.
A mapping is the schema for this table.

So type and mapping are related.

You can think about an index as a schema in SQL. A schema contains a lot of table. Here you could potentially use multiple types within the same index.

BUT: if possible I'd use only one type within one index. You might have field names conflicts otherwise.
i.e.: a type A can define a field foo. A type B within the same index won't be able to define the same field name foo.

HTH

thanks for that explanation and the important remark.
i don't know, but i also have the feeling to use two indices instead of mutliple mappings in one index. of course in sql i would not do that

what means HTH? :slight_smile:

Have a nice day
David

HTH= Hope this helps

:slight_smile:

1 Like