ElasticSearch & Mongo

A very newbie question I suppose .. I started playing with ES and MongoDB, and I'm trying to move data from an SQL database as an exercise. I cannot help but wonder what data I will store in Mongo and what in ES? Can I store everything in ES? Suppose a large load of data, as in price trends.

+5
source share
2 answers

For starters, MongoDB is the so-called document repository. A key feature of this concept is the preservation of dynamic diagram documents:

  • Each entry in a document collection may have a different structure.
  • The types of each entry may be different.
  • Document properties (columns) can have nested structures

This is not a circuit-free, this is a dynamic circuit (or flexible circuit). To familiarize yourself with the concept, you can find a great tutorial here: https://docs.mongodb.org/manual/data-modeling/

MongoDB is the most widely used document repository - see http://db-engines.com/en/system/MongoDB .

It has β€œdrivers” for most programming languages, which allows it to develop rapidly. You can quickly dive into Mongo, there are many textbooks and the official Mongo University - an excellent course for developers and database administrators.

In the shortest possible time, it supports indexing, aggregation, filters, load balancing, shards, replications (sets of replicas), etc. Data is saved and transmitted in BSON format ( <a2> ).

A good comparison of MongoDB and RDBMS concepts can be found in this official link: https://docs.mongodb.org/manual/reference/sql-comparison/

What is this good for? It provides agile development where the layout can change over time, especially form-based data, user-generated content, location data, user profiles, and more. It also allows you to store large documents (up to 16 MB each).

Elasticsearch is now not a database. This is a search engine with some great aggregation capabilities ( https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html - make sure you check the Metrics, Buckets and Pipeline aggregates).

Typical RDBSM is not intended for full-text search or loosely structured data. Queries in ES can return results much faster than any database (for example, seconds in an RDBMS compared to milliseconds in ES). You must remember that the key is to design indexes well and that they will occupy your disk space.

There is a very detailed article comparing both performance and utility: http://blog.quarkslab.com/mongodb-vs-elasticsearch-the-quest-of-the-holy-performances.html .

In fact, you can use both options - MongoDB will store your data, where ES will be used as a service level (search, clusters, etc.).

+4
source

There is a big difference between mongodb and ES. MongoDB is a database that was designed to store data and queries in it, while elasticsearch is the base index of lucene, in which you should index data only for search and should not trust elastisearch. even if you can use store: true in a resilient search, this is not recommended, and I will not rely on this for important data.

0
source

Source: https://habr.com/ru/post/1244375/


All Articles