3 ms·
Serious question: is there any real reason to use Mongo over Elasticsearch?
by whalesalad 8y ago
Serious question: is there any real reason to use Mongo over Elasticsearch?
- a13n 8y agoI run a startup that uses both of these. Mongo is a heck of a lot easier to configure and develop with, and works great as a general database with a rapidly changing schema. Elasticsearch is great at solving specific problems like searching for items in a specific way, but it's got quite a learning curve and is pretty painful to host and configure compared to Mongo where you can have a prod instance going in seconds.
- ajsharp 8y agoYes. Elasticsearch is not nearly as easy to use and is not really designed to be a transactional database.
- alrs 8y agoElasticsearch is a distributed index, not a reliable document store. You can expect availability problems and data loss. This is fine, because you can rebuild the index from your source of truth.
- rafaelturk 8y agoTrue.
- plasma 8y agoIn my experience with ES, definitely don't treat it as a source of truth; allow it to be rebuilt.
- StreamBright 8y agoIs it a good idea to use a database instead of a search engine?
- throwaway204 8y agoES grew out of Lucene, which provided an inverted index of all the text in a document, with a bunch of NLP related features bolted onto that. While ostensibly designed to be developer friendly, ES had and still has a horribly hacked together API with bugs and mis-documented misfeatures all over the place. In my experience it's anything but developer friendly. But if all you need is a text index on a document store with a static schema, it does its job reasonably well. Mongo started as a very developer-friendly data store with lots of overstated claims to being a database. While earlier versions of Mongo were wildly dangerous to use as a business critical database, it has since matured and is now quite good at being a developer-friendly document-centric database. In my experience Mongo truly is developer-friendly as long as you don't try to use it as a full-blown transactional database with lots of complex data shapes and indexes. I would not trust ES with anything but text search on a document store, and I would not trust Mongo with anything resembling multi-document transactions. With that said, they are both good at specific, different things. MySQL and Postgres have their own baggage that makes them pretty terrible in some aspects. IMHO a JSON-over-HTTP API should really be table stakes for a database to be considered developer-friendly nowadays. (But please don't butcher HTTP like ES did and then claim to have that.)
- zepolen 8y ago> IMHO a JSON-over-HTTP API No no no no, again no. We don't need yet another shitty query language bolted onto one of the most error prone and annoying to type serialization formats while transmitting data on top of a by default stateless protocol that makes no sense for a database. I'm sick of it. SQL. The same queries will work in 95% of the case on any SQL db. There is a driver in almost every language that is robust. There are implementations great for every use case; embedded, scalable, transactional. That's friendly. There is nothing wrong with SQL, it's freaking awesome.
- throwaway204 8y agoSure, keep the SQL. Just make it a field in a JSON POST payload, and send the results back as JSON. The "drivers in almost every language" suck. They all suck. I've never seen a SQL driver and wire protocol that was not awful in some way. The statefulness is part of what makes them awful. We have better ways to keep track of state now.
- outworlder 8y agoApples and Oranges. Some use-cases may overlap, but not all. For instance, why would you use MongoDB for centralized logging, as opposed to the ELK stack?