EVENTGet 50% off your ticket to MongoDB.local NYC on May 2. Use code Web50! Learn more >

Elasticsearch vs MongoDB Atlas Search

Atlas Search combines three systems - database, search engine, and sync mechanisms - into one to deliver application search experiences 30-50% faster. Atlas Search is the easiest way to build rich, fast, and relevance-based search, without burdening your developers and IT operations teams with additional technologies to deploy, learn, and maintain.

The Challenges of Application Search

Search is ubiquitous in application experiences. Whether we are shopping for groceries or buying a new home, browsing the web to find answers to our burning questions, servicing our customers, looking for our next job, or seeking suggestions for our next vacation, the search bar helps us navigate and discover the most relevant information — all in a way that seemingly interprets our natural language. People now expect these same intuitive search experiences in every application they use, whether at home or at work.

However, building these experiences is hard. In many cases, developers have to ‘bolt-on’ a search engine like Elasticsearch to their database and create a replication mechanism to keep the two systems synchronized. This approach introduces a huge amount of complexity to the application stack, reducing developer velocity while driving up risk, complexity, and cost.

What is Elasticsearch?

Elasticsearch is a distributed search and analytics engine built on top of Apache Lucene and developed by Elastic. It extends Lucene’s indexing and search functionalities using RESTful APIs, and it achieves the distribution of data on multiple servers using the index and shards concept. Elasticsearch is based on JSON and is suitable for search use cases against time series data, structured or unstructured text, numerical data, or geospatial data.

Deployment options include self-hosting Elasticsearch, where the user is self-managing their instance, and Elastic’s cloud-hosted variant included in Elastic Cloud (which includes the rest of the ELK stack).

What is MongoDB Atlas Search?

MongoDB Atlas Search makes it easy to build fast, relevant, full-text search on top of your data in the cloud. By embedding an Apache Lucene search engine directly alongside your database, data is automatically synchronized between the two systems, developers work with a single driver and API, there is no separate system to run and pay for, and everything is fully-managed for you. It combines the power of Apache Lucene with the developer productivity, scale, and resilience of the MongoDB Atlas database.

With just a couple of API calls or clicks in the Atlas UI, you instantly expose your data to sophisticated, relevance-based search experiences that boost engagement and improve customer satisfaction. Your data is immediately more discoverable, usable, and valuable - while it’s all fully managed for you in the cloud, removing operational burden. Customers have reported 30% to 50% improvements in time to market for new application functionality by adopting Atlas Search.

What MongoDB Atlas Search offers over Elasticsearch

A closer look at the respective approaches of Elasticsearch and MongoDB Atlas Search

Architecture

Elasticsearch: A Bolt-On approach

If a database’s internal search features are not adequate to satisfy the desired user experience, then another option is to bolt-on a dedicated search engine, such as Elasticsearch, alongside the database.

This provides the search features demanded by customers, but it does so while imposing additional constraints on developers and ops teams while driving up data duplication and technology sprawl.

A bolt-on specialized search engine alongside your database mandates synchronizing data between the two systems. While users get the rich search experience they expect, this comes at a significant cost. The application stack gets more complex and unwieldy. All of this translates to reduced developer velocity, compromised customer experience, and escalating costs.

How search works with a bolt-on solution:

Bolt On

Synchronization Overhead

To surface relevant and up-to-date search results, the database and search engine need to be kept synchronized, duplicating data between systems.

This means engineering teams need to create a synchronization mechanism that replicates data from the database to the search engine. Typically they will create a data pipeline with custom filtering and transformation logic built on top of messaging systems such as Apache Kafka, or using packaged connectors from specialized providers. Whether building or buying, the process takes time and adds ongoing costs. The synchronization mechanism also has to be deployed onto its own nodes, creating additional hardware sprawl.

Once the synchronization mechanism has been deployed, it needs to be monitored and managed, adding more engineering overhead.

It is important that replication to the search engine keeps pace with database writes so that search results do not excessively lag the database and break application SLAs. Monitoring the replication process is necessary to identify and remediate synchronization issues. This becomes especially complex if the search index falls so far behind the database that it has to be resynced from scratch, causing potential application downtime. It is not uncommon to find that 10% of engineering cycles are lost to manually recovering synchronization failures.

New application features that necessitate changes to the database’s schema often need both the synchronization logic and the search engine schema to also be updated at the same time. This creates more dependencies that slow down the pace of rolling new features to production.

How MongoDB Atlas Search is different

Atlas Search is built on top of MongoDB, the most popular and widely used modern database in the market. MongoDB has become so popular because engineering teams can build and ship applications faster than other data platforms. You can get started with both MongoDB Atlas and Atlas Search in minutes on a fully managed service that handles operations for you — on any cloud you choose.

By embedding an Apache Lucene search index directly alongside the database, data is automatically synchronized between the two, developers work with a single API, there is no separate system to run and pay for, and everything is fully managed for you, relieving operational burden. The MongoDB developer data platform radically simplifies your data architecture, enabling you to gain a competitive advantage by innovating faster while reducing cost, risk, and complexity.

Atlas Search Arch

With a distributed architecture, your database and search engine is resilient and globally scalable. Replication with self-healing recovery keeps your applications highly available while giving you the ability to isolate operational and search workloads on separate nodes within a single cluster. Native sharding provides elastic and application-transparent horizontal scale-out to accommodate your workload’s growth, along with geographic distribution for data residency controls. These controls ensure that data is kept close to users for low latency and to comply with data sovereignty mandated by modern privacy regulations.

Atlas Search is part of MongoDB Atlas, the multi-cloud developer data platform that combines transactional processing, relevance-based search, real-time analytics, mobile edge computing with cloud sync, and a federated query engine in an elegant and integrated data architecture. Through a flexible document data model and unified query interface, Atlas provides a first-class developer experience to power almost any class of application. At the same time, it meets the most demanding requirements for resilience, scale, and data privacy.

Why not just use a Search Engine as a Database?

With search engines storing and querying data, some engineering teams may consider eliminating the database altogether and just using the search engine for data persistence. At first glance, this would address many of the constraints discussed above, presenting a single system to develop against and to operationalize, while eliminating the overhead of data synchronization.

But as noted earlier, databases and search engines are different technologies designed to do different things.

Beyond serving application queries, databases are designed around a core set of data persistence and processing capabilities. These demand data integrity, consistency, and durability; balanced performance across reads and writes; concurrency; availability; security; disaster recovery; and more.

With a specialized architecture and indexing focused on fast, relevance-based information retrieval, dedicated search engines have a different set of design goals that compromise many of the capabilities that make databases so essential.

Elastic themselves caution against using a search engine as a database both in press articles and in core product documentation.

As discussed above, Elasticsearch is a capable search engine technology. However, its core system architecture is built around Lucene indexes in a way that forces compromises in many core database capabilities in order to meet its primary design goal as a scalable search engine.

User Reviews

What are the pain points users are experiencing when going down the path of a Bolt-On approach

DevOps

The Impact on Developer Productivity

It is critical in today’s digital economy for developers to build and evolve applications at speed. Introducing a separate search engine, like Elasticsearch, alongside the database means developers now have two separate systems they need to work with, which slows them down.

With this approach, developers have to learn how to work with two entirely different query languages to access the database and the search engine. This increases their learning curve and means frequent context switching when building application functionality, both of which impact their productivity while complicating testing and ongoing maintenance.

Because this approach requires two different APIs/drivers, application dependencies become much more complex, reducing the pace and frequency of releasing applications to production.

The DevOps Burden

Doubling up with a database and separate search engine such as Elasticsearch also adds time, cost, and complexity to operations and site reliability engineering (SRE) teams.

Now they have an additional system in their technology stack that needs constant care and feeding: It has to be provisioned, secured, monitored, scaled, patched, and backed up with its own tooling and APIs. It also means working across multiple vendors, making issue resolution more complex. Every new project means another dataset living in its own silo, adding to data sprawl and governance overhead.

Bolt On

How MongoDB Atlas Search is Different..

..for the Developer

The document data model is intuitive and flexible. Documents map directly to the objects in your code so they are much easier and more natural to work with. You can store, index, and search data of any structure and modify your schema at any time as you add new features to your applications.

You work with data as code. The MongoDB Query API and drivers are idiomatic to your programming language. Ad hoc queries, indexing, full-text search, and real-time aggregations provide powerful ways for accessing, grouping, transforming, searching, and analyzing your data to support any class of workload.

..for IT Operations

By embedding an Apache Lucene search index directly alongside the database, data is automatically synchronized between the two. This means engineers and administrators work with a single API, there is no separate system to run and pay for, and everything is fully managed for you, relieving operational burden. The MongoDB developer data platform radically simplifies your data architecture, enabling you to gain a competitive advantage by innovating faster while reducing cost, risk, and complexity.

Why choose MongoDB Atlas Search?

Eliminate synchronization overhead

Data is automatically and dynamically synced from the Atlas database to Atlas Search indexes. Developers and DevOps avoid having to stand up and manage their own sync mechanism, write custom transformation logic, or remap search indexes as the database schema evolves.
Learn more →

Ship new features faster

Developers now work with a single, unified API across both database and search operations, simplifying queries and reducing development time. They no longer need to context switch between different query languages, and with a single driver, build dependencies are reduced by consolidating the driver packages that need to be added to the application code for client access. They can also test queries and preview results with interactive tools to fine-tune performance and scoring before deploying them directly into application code. Developers and IT operations can also get back the 10% of engineering cycles previously lost to manually recovering sync failures, reinvesting that time to innovate for end users.
Learn more →

Remove operational heavy-lifting

MongoDB Atlas automates provisioning, replication, patching, upgrades, scaling, security, and disaster recovery while providing deep visibility into performance for both database and search. By working with a single platform, developers avoid the exponential increase in the number of system components you need to design, test, secure, monitor, and maintain.
Learn more →

Is Atlas Search Always the Right Solution?

The above examples demonstrate how Atlas Search is designed for application search use cases. By design, it is tightly integrated with the MongoDB Atlas platform. Therefore all data has to first be stored in MongoDB database collections in order to then create the required search indexes against it.

Atlas Search is not currently designed for log analytics typically used in DevOps observability or security and threat hunting applications. Atlas Search is also not suitable for enterprise-wide search systems. In these scenarios, Elasticsearch provides built-in connectors and agents to crawl and extract data from multiple internal source systems, index them, and then make data and analytics searchable with bespoke tools.

For these use cases, it can be better to use MongoDB as one of your data sources alongside your existing Elasticsearch search engine.

Getting Started With Atlas Search

MongoDB Atlas offers a forever-free tier for development. Once deployed, simply click a button to add search to your application. With unlimited time to explore, see for yourself how a fully managed search engine integration helps your team build applications faster

Atlas Search is available with all Atlas clusters — including free clusters — so you can evaluate it at no cost.

Our Getting Started tutorial steps you through the process. Atlas Search documentation provides a complete reference on how to configure, manage, and query search indexes, along with performance recommendations. The MongoDB Developer Hub and MongoDB YouTube channel provide a wealth of articles and tutorials for beginners through to expert users.

Migrating from Elasticsearch?

If you currently employ Elasticsearch as a bolt on to your database, we have developed a 5-step methodology to help you migrate away from the headache of managing two independent schemas and data sets.

The guide steps you through how to:

  • Qualify target workloads
  • Migrate your existing indexes
  • Migrate your existing queries
  • Validate and relevance-tune your Atlas Search queries and indexes
  • Size and deploy your Atlas Search infrastructure

The guide wraps up with examples of customers that have made the switch and provides guidance on how to get started with Atlas Search, along with key services that can help you in your journey.

Learn more →

Support Throughout Your Application Lifecycle

Advisory Consulting
MongoDB's Professional Services team is available as a trusted delivery partner to help you and your teams bring applications built with Atlas Search to life. Whether you need support with one specific element of your application lifecycle (e.g. training), or you need guidance throughout the entire journey, we’re here to provide the right type of services you need to be successful with your search project.
Flex Consulting
Flex Consulting is available directly from the Atlas UI. It provides your teams access to consulting engineers for short, remote sessions to target specific technical hurdles. These range from applying best practices and design patterns for first time Atlas Search users, moving data into MongoDB Atlas from existing databases and external search engines, to optimizing existing Atlas Search queries and indexes.

Frequently Asked Questions

MongoDB Atlas Search addresses a broad spectrum of search requirements without burdening your DevOps teams with undifferentiated work.

Full-text search is a technology used to efficiently query, filter, and display matching data from vast corpuses of stored information. Despite its name, almost any type of data can be searched – it’s not just text!

A well implemented full-text search solution delivers fast and relevant search experiences to your application’s users. It boosts their engagement and improves satisfaction by making data more discoverable, usable, and valuable.

The key to full-tech search is the inverted index – a specialized structure for indexing and storing data that’s optimized for efficient search queries. Think of an inverted index as a glossary that lists all the unique values that appear in a document. Each value has a list of the documents in which it appears and the value’s position within that document.

How is full-text search different from a database?

Databases are ideal when you know exactly what information you are looking for, i.e., show me all customers that have created an Atlas Search index in the past month. When developers know these queries up-front, the appropriate indexes can be defined on the data.

Full-text search is ideal when your users' queries are more open-ended, and they are open to suggestions, i.e., show me the most valuable articles on Atlas Search. In these instances, inverted indexes are much more efficient at returning the most relevant results.

Full-text search engines also offer additional features that databases either do not, or that they do not do well, i.e., fuzzy search (typo-tolerance), autocomplete (typeahead and presenting suggested search terms), faceted navigation (displaying categories of search results), synonyms (to define similar search terms), custom scoring (to tune the relevance of search results), analyzers (to control how data is indexed).

Is Elasticsearch like MongoDB?

Both have different use cases. When it comes to application search scenarios, Elasticsearch is generally used as a 'bolt-on' search engine, while MongoDB is a developer data platform that allows three systems to be compressed into a single solution.

By integrating a database, search engine and sync mechanism into a single unified and fully managed platform, Atlas Search is the fastest and easiest way to build relevance-based search directly into your applications.

How do I add data to Elasticsearch from MongoDB?

When Elasticsearch is used with MongoDB, data needs to be synchronized between the two databases. Some tools, i.e. Kafka or dedicated ETL processes, exist to perform this complicated task. Atlas Search abstracts and automates this overhead, handling the changes in both data and schema. This is a fully managed process without requiring any manual setup, configuration nor any on-going maintenance.

Is Atlas Search available for free tier?

Yes, Atlas Search is available for both free tier and paid customers.

Atlas Search is priced in the same way as other data storage and compute resources are calculated for Atlas. There is no separately priced SKU and it consumes the same Atlas Credits.

Details of how Atlas is billed can be found here.

Additionally, MongoDB Atlas Search is available via the AWS Marketplace, Google Cloud Platform Marketplace, and Microsoft Azure Marketplace. In each case, these help streamline procurement to align with your existing Cloud Service Provider's services.

For information on how to set up or use Atlas Search, see Atlas Search Docs.

Does Atlas Search support partial string matching?

Yes. Partial string matching queries are possible by using the following Atlas Search operators:

Does Atlas Search support case-insensitive searches?

Yes. It is possible to perform a case insensitive search using a custom analyzer alongside the wildcard and regex operators.

To perform a wildcard case-insensitive search, the custom analyzer is defined using the following tokenizer and token filter:

Is Atlas Search available for non-Atlas MongoDB deployments?

No, Atlas Search is only available for Atlas clusters running MongoDB 4.2 or higher.

MongoDB offers legacy text search that supports basic queries on string content. However, text indexes only work for text-based content and the $text operator can be modified in limited ways.

In comparison, MongoDB Atlas Search offers:

Better results: Atlas Search can provide more ways to fine-tune the relevance of search results and support faster query results because it’s based on Apache Lucene, the open source search engine that also powers Elasticsearch and Solr.

Rich feature set: Atlas Search offers support for over 35 languages, multiple data types, fuzzy search, autocomplete, synonyms, custom scoring, index intersection, highlighting, and multiple search indexes per collection.

Defined roadmap: Atlas Search is constantly being improved with new features that help us increase the range of use cases you can target with Atlas Search.

Trusted by:

Ready to get started?

Launch a new cluster or migrate to MongoDB Atlas with zero downtime.