# Understanding index vs mapping

**URL:** <https://discuss.elastic.co/t/understanding-index-vs-mapping/51291>\
**Category:** Elasticsearch\
**Created:** [May 30, 2016, 8:47am UTC](https://discuss.elastic.co/t/understanding-index-vs-mapping/51291 "2016-05-30T08:47:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveyx](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daveyx/32/35298_2.png) [@daveyx](https://discuss.elastic.co/u/daveyx)\
**Post date:** [May 30, 2016, 8:47am UTC](https://discuss.elastic.co/t/understanding-index-vs-mapping/51291/1 "2016-05-30T08:47:43Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 30, 2016, 9:30am UTC](https://discuss.elastic.co/t/understanding-index-vs-mapping/51291/2 "2016-05-30T09:30:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daveyx](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daveyx/32/35298_2.png) [@daveyx](https://discuss.elastic.co/u/daveyx)\
**Post date:** [May 30, 2016, 9:48am UTC](https://discuss.elastic.co/t/understanding-index-vs-mapping/51291/3 "2016-05-30T09:48:03Z")

</div>

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? 🙂

Have a nice day  
David

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 30, 2016, 10:15am UTC](https://discuss.elastic.co/t/understanding-index-vs-mapping/51291/4 "2016-05-30T10:15:10Z")

</div>

HTH= Hope this helps

🙂

---

<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 5, 2017, 10:48pm UTC](https://discuss.elastic.co/t/understanding-index-vs-mapping/51291/5 "2017-07-05T22:48:06Z")

</div>


