Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticSearch vs Relational Database

I'm creating a microservice to handle the contacts that are created in the software. I'll need to create contacts and also search if a contact exists based on some information (name, last name, email, phone number). The idea is the following: A customer calls, if it doesn't exist we create the contact asking all his personal information. The second time he calls, we will search coincidences by name, last name, email, to detect that the contact already exists in our DB. What I thought is to use a MongoDB as primary storage and use ElasticSearch to perform the query, but I don't know if there is really a big difference between this and querying in a common relational database.

EDIT: Imagine a call center that is getting calls all the time from mostly different people, and we want to search fast (by name, email, last name) if that person it's in our DB, wouldn't ElasticSearch be good for this?

like image 332
Leandro Avatar asked Aug 01 '18 17:08

Leandro


People also ask

Is Elasticsearch a relational database?

Because Elasticsearch is not a relational database, joins do not exist as a native functionality like in an SQL database. It focuses more on search efficiency as opposed to storage efficiency. The stored data is practically flattened out or denormalized to drive fast search use cases.

What is difference between Elasticsearch and database?

Elasticsearch is a search and analytics engine based on Apache Lucene. MS SQL is a relational database model. 2. The primary database model is a search engine.

When should I use Elasticsearch vs RDBMS?

@emilly Elasticsearch is build for fast searches and is really good in that specific task, but ES isn't fully ACID compliant. You can use a RDBMS as primary store and synchronize the data to Elasticsearch for fast searches (using feeders(rivers) for example).

Should I use Elasticsearch as a database?

Elasticsearch should be used at places where you will need almost or near real time searches or record displays. It will easily do better than your standard database when it comes to reads. Elasticsearch is great for analytics.


1 Answers

A relational database can store data and also index it.

A search engine can index data but also store it.

Relational databases are better in read-what-was-just-written performance. Search engines are better at really quick search with additional tricks like all kinds of normalization: lowercase, ä->a or ae, prefix matches, ngram matches (if indexed respectively). Whether its 1 million or 10 million entries in the store is not the big deal nowadays, but what is your query load? Well, there are only this many service center workers, so your query load is likely far less than 1qps. No problem for a relational DB at all. The search engine would start to make sense if you want some normalization, as described above, or you start indexing free text comments, descriptions of customers.

like image 197
Harald Avatar answered Oct 02 '22 08:10

Harald