Elasticsearch Explained wrt Relational Database

Rahul
2 min readSep 9, 2018

--

Elasticsearch is a near real time search platform what this means is there is a slight latency (normally one second) from the time you index a document until the time it becomes searchable.

Underlying Architecture:

The way it does searching is very similar to such as searching a particular term or a word in the INDEX section of a book. Every book has index page where the list of most important and common terms are mentioned with there page numbers.

History: Elasticsearch is built no top of a search engine named as LUCENE (lucene.apache.org) which was released in 1998 as a part of apache project. The underlying data structure used in that software is INVERTED INDEX which basically maps words or numbers to the actual document locations of where those words occur.

The documentation of Elasticsearch also provides a good overview of inverted index. https://www.elastic.co/guide/en/elasticsearch/guide/current/inverted-index.html

Elastic Search is document oriented which means it works with documents.A document is a basic unit of information that can be indexed. For example, you can have a document for a single customer, another document for a single product, and yet another for a single order. This document is expressed in JSON (JavaScript Object Notation) which is a ubiquitous internet data interchange format. Each document is a separate entry in elastic just like a row is a separate entry in a database.

How Elasticsearch related to database:

So a Column in a DB can be considered as a Field in Elastic search and similarly a Row in DB can be considered as a Document.

So as in the above screenshot. Vehicles is the index(Database), Cars, Motorcycle, Trucks are the Type (Tables).

The different cars, motorcycles are the different documents(Rows).

Conclusion: Elasticsearch is both a simple and complex product. We’ve so far learned the basics of what it is and how to look inside of it. Hopefully this inspired you to further experiment with the rest of its great features!

--

--

No responses yet