Elasticsearch Difference Between Relational Databases and Elasticsearch Terminology Difference


Example

Relational DatabaseElasticsearch
DatabaseIndex
TableType
Row/RecordDocument
Column Namefield

Above table roughly draws an analogy between basic elements of relational database and elasticsearch.

Setup

Considering Following structure in a relational database:

create databse test;

use test;

create table product;

create table product (name varchar, id int PRIMARY KEY);

insert into product  (id,name) VALUES (1,'Shirt');

insert into product  (id,name) VALUES (2,'Red Shirt');

select * from product;

name      | id 
----------+----
Shirt     |  1
Red Shirt |  2

Elasticsearch Equivalent:

POST test/product
{
    "id" : 1,
    "name" : "Shirt"
}

POST test/product
{
    "id" : 2,
    "name" : "Red Shirt"
}

GET test/product/_search


"hits": [
     {                                      ==============
        "_index": "test",                   ===> index    |
        "_type": "product",                 ===>type      |
        "_id": "AVzglFomaus3G2tXc6sB",                    |
        "_score": 1,                                      |
        "_source": {                                      |===> document
           "id": 2,                        ===>field      | 
           "name": "Red Shirt"             ===>field      |
        }                                                 |
     },                                     ==============
     {
        "_index": "test",
        "_type": "product",
        "_id": "AVzglD12aus3G2tXc6sA",
        "_score": 1,
        "_source": {
           "id": 1,                 
           "name": "Shirt"           
        }
     }
  ]