Elasticsearch vs MongoDB — When to use what
I was told a scenario(you will find in the middle of this blog) and asked which one is more appropriate to store and retrieve data, Elastic or Mongo? Unfortunately I was not able to give a convincing answer in less than a minute.
All I could tell was, both are document based and use JSON format. Elastic is index based and MongoDB is NoSQL. As you can see, this information gives no clear justification to choose between either of the two technologies for any scenario.
So, I thought I will write a shortest comprehension possible to explain both in a nutshell. After reading this post, you would be able to select the most relevant one by just looking at my use case.
I added my problem statement and at the end of this blog I also added the solution I suggested.
If you are able to figure out the relevant one, HURRAY!! You understood both the techs and can make decisions on selecting between the two for your use cases.
Problem Statement: I want to have an application that stores documents which is readily available to the users as soon as I publish. I also want to have a search engine to crawl inside the documents and get the most relevant results.
First of all, What is the sole purpose of both? Why even these two exist when we have traditional RDBMS