Index->table, document->row?

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?

Hi @li_jessen2016,

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]

Regards
Nikhil Kapoor

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.

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

Regards
Nikhil Kapoor

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

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