Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What advantages does MongoDB offer over ElasticSearch as a NoSQL database only

I'm quite new to NoSql databases, but I'm really lovin' MongoDB with the official c# driver. It's currently the backend to an MVC application I'm writing, and the simplicity AND speed make my life way way easier.

However I've come to that point in the application where I need really great search. I used to use Solr, but have become quite interested in ElasticSearch.

ElasticSearch, as far as I can tell (from a very superficial level), can do everything MongoDB can in terms of being a document database.

So, if I'm already using a NoSql db, and I need great search, is there any point in Mongo? What's the use case?

Is Mongo faster? Easier to use? Is it the BSON datatypes and drivers? Why not use ElasticSearch as my DB?

I'm currently using AppHarbor and lovin' "The Cloud". I hate IT and want to focus on my application only. With that said, the only advantage I see so far is:

  • There are already a number of "Cloud" MongoDB providers. With ElasticSearch I've got to set it all up myself.
like image 489
andy Avatar asked Jun 13 '12 10:06

andy


People also ask

What is the advantage of MongoDB over other NoSQL databases?

MongoDB NoSQL databases and relational databases differ in many ways. Not only is MongoDB easy-to-use, but it also supports excellent scaling options. Moreover, the performance capabilities of MongoDB are unbeatable compared to other databases.

Which is better MongoDB or ElasticSearch?

Elasticsearch takes first place in search engine and seventh place overall. MongoDB has the first rank in document store databases and fifth overall.

How is MongoDB different from ElasticSearch?

Elasticsearch is built for search and provides advanced data indexing capabilities. For data analysis, it operates alongside Kibana, and Logstash to form the ELK stack. MongoDB is an open-source NoSQL database management program, which can be used to manage large amounts of data in a distributed architecture.

What is the main advantage of MongoDB?

MongoDB is designed to make data easy to access, and rarely to require joins or transactions, but when you need to do complex querying, it's more than up to the task. The MongoDB Query API allows you to query deep into documents, and even perform complex analytics pipelines with just a few lines of declarative code.

Why is MongoDB the best NoSQL database?

MongoDB is better than other SQL databases because it allows a highly flexible and scalable document structure. For example: One data document in MongoDB can have five columns and the other one in the same collection can have ten columns.


1 Answers

This is a very good question. I have asked myself the same question and came up with the following answer.

  1. ElasticSearch doesn’t have a good way to backup data. As an example, do a quick search for “ElasticSearch backup” and one for “mongodb backup”. MongoDB has tools and documentation on how to backup data. While there is documentation on how to backup ElasticSearch data, this documentation doesn’t seem as mature.
  2. In general, MongoDB has much better documentation. In particular its admin documentation is much better than ElasticSearch.
  3. MongoDB provides commercial support. You might not care about commercial support at the moment, but it is nice to know it is available.
  4. MongoDB has MapReduce built in, ElasticSearch does not. This may not be a big thing, but worth noting.

My personal opinion is that I wouldn’t use ElasticSearch if you cannot afford to lose data. I could see using ElasticSearch as a primary data store for something requiring real-time analytics, but did not have any long-term data retention requirements. Otherwise, I would suggest using MongoDB and ElasticSearch together. There is a MongoDB River Plugin for ElasticSearch. This makes it pretty easy to update the ElasticSearch index automatically.

like image 109
Shawn H Avatar answered Sep 30 '22 05:09

Shawn H