liveBook · Manning

Elasticsearch

As explained in MongoDB 8.0 in Action, Third Edition

Elasticsearch is a distributed search and analytics engine for indexing, searching, and analyzing structured and unstructured data.

Elasticsearch is a distributed, RESTful search and analytics engine for indexing, searching, and analyzing large volumes of structured or unstructured data. It supports full-text search and can also serve as a destination for searchable operational logs. section 11.1 section 21.3.2

Choose Elasticsearch when its search and analytics capabilities justify the operational trade-offs:

  • Use it as a dedicated search engine when database-native search cannot accommodate sophisticated requirements, including searches across multiple nested fields. section 11.1
  • Replicate database collections into Elasticsearch when applications need separate search infrastructure, but plan for synchronization, monitoring, configuration, and maintenance. section 11.1
  • Send Atlas logs to Elasticsearch when fast log searching and analysis are useful, then use Grafana to visualize trends and identify database problems. section 21.3.2

Replicated search and monitoring

A MongoDB application can replicate collection changes to Elasticsearch through Monstache, which uses change streams to monitor updates and send them to the search cluster. A separate deployment can send Atlas logs to Elasticsearch and connect Grafana for dashboards. These arrangements improve search or observability, but add resource usage and consistency concerns. section 11.1 section 21.3.2

Figure 11.1 High-level data synchronization architecture. The application uses separate drivers and query languages to interact with the database and search clusters. Data is replicated from the database cluster to the search cluster to keep the index updated. This setup adds complexity, increases resource usage, and can lead to consistency issues. (Image © MongoDB 2024 CC BY-NC-SA 3.0)
A diagram of a computer language

Description automatically generated

Inspect the high-level architecture showing separate database and search clusters, drivers, query languages, and replicated index updates. section 11.1

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Explains architecture, replication, and operational trade-offs but stops short of Elasticsearch commands, schema design, or query implementation.
Examples
Uses MongoDB collection replication, Monstache change streams, Atlas log delivery, and Grafana dashboards as concrete integration examples.
What it assumes
Assumes familiarity with databases, full-text search, replicated data, and operational monitoring.
What you can do after
Evaluate Elasticsearch for advanced search or log analysis while accounting for synchronization, monitoring, resource, and consistency costs.
How it connects
Connects full-text search with MongoDB, Atlas Search, Solr, Algolia, Apache Lucene, Monstache, Grafana, and Datadog.

Also explained in

Compare how 5 books explain Elasticsearch →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.