# Index-\>table, document-\>row?

**URL:** <https://discuss.elastic.co/t/index-table-document-row/166890>\
**Category:** Elasticsearch\
**Created:** [February 4, 2019, 3:37am UTC](https://discuss.elastic.co/t/index-table-document-row/166890 "2019-02-04T03:37:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![li\_jessen2016](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/li_jessen2016/32/38817_2.png) [@li\_jessen2016](https://discuss.elastic.co/u/li_jessen2016)\
**Post date:** [February 4, 2019, 3:37am UTC](https://discuss.elastic.co/t/index-table-document-row/166890/1 "2019-02-04T03:37:51Z")

</div>

I wanna make some rough comparison between Elasticsearch basic concepts and that of legacy DB.  
Can we say that index is similar to table, document is similar to row, and field is similar to column?

---

<div class="post-metadata">

**Author:** ![nikhil.k](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@nikhil.k](https://discuss.elastic.co/u/nikhil.k)\
**Post date:** [February 4, 2019, 4:27am UTC](https://discuss.elastic.co/t/index-table-document-row/166890/2 "2019-02-04T04:27:05Z")

</div>

Hi @li_jessen2016,

> [@li\_jessen2016](#):
>
> Can we say that index is similar to table, document is similar to row, and field is similar to column?

Yes, their purpose is same. For more details, kindly refer to the the given link  
[[Mapping concepts across SQL and Elasticsearch | Elasticsearch Guide [6.4] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/6.4/_mapping_concepts_across_sql_and_elasticsearch.html#_mapping_concepts_across_sql_and_elasticsearch)]

Regards  
Nikhil Kapoor

---

<div class="post-metadata">

**Author:** ![li\_jessen2016](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/li_jessen2016/32/38817_2.png) [@li\_jessen2016](https://discuss.elastic.co/u/li_jessen2016)\
**Post date:** [February 6, 2019, 3:39am UTC](https://discuss.elastic.co/t/index-table-document-row/166890/3 "2019-02-06T03:39:07Z")

</div>

But if there are more than one type per index, then maybe one type refer to one table and one index is a collection of multiple tables.

---

<div class="post-metadata">

**Author:** ![nikhil.k](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@nikhil.k](https://discuss.elastic.co/u/nikhil.k)\
**Post date:** [February 6, 2019, 4:19am UTC](https://discuss.elastic.co/t/index-table-document-row/166890/4 "2019-02-06T04:19:30Z")

</div>

Hi @li_jessen2016,

Yes, you can say that. But from elasticsearch version 6.0 an index cannot have several types in a single index i.e. an error message will be shown on the console `"Rejecting mapping update to [index_name] as the final mapping would have more than 1 type".`

Kindly refer to the below link:  
[https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html)

Regards  
Nikhil Kapoor

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [February 6, 2019, 2:21pm UTC](https://discuss.elastic.co/t/index-table-document-row/166890/5 "2019-02-06T14:21:19Z")

</div>

> [@li\_jessen2016](#):
>
> But if there are more than one type per index, then maybe one type refer to one table and one index is a collection of multiple tables.

Having more than one type in an index is more like having a `type` column in a table. All of the statistics are global to the index rather the per-type. This is a _super_ important distinction because for Elasticsearch and for a relational database. In a relational database you'd feel bad if rows with different `type`s had very different "shapes". Like if rows with the type `foo` left columns `a`, `b`, and `c` null _every_ time and if rows with the type `bar` left columns `d`, `e`, and `f` null _every_ time. The statistics would be all wrong and the merge plans would be garbage. In Elasticsearch it is the same way but different. Instead of bad merge plans you get less efficient storage and aggregations and "weird" scoring. The trouble is that `type` _looks_ like it offers isolation that it doesn't offer. Which is ultimately why we're removing `type`.

---

<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:** [March 6, 2019, 2:21pm UTC](https://discuss.elastic.co/t/index-table-document-row/166890/6 "2019-03-06T14:21:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
