New Ways to Deliver Excellent Search Experiences With Atlas Search

MongoDB

#MongoDB World

We’re pleased to announce several new and recently released Q2 features in Atlas Search designed to help you build relevance-based search directly into your applications. With the introduction of facets on sharded collections (available in MongoDB 6.0), embedded documents in arrays (available in preview), and cross-collection search using $lookup and $unionwith, you have even more tools to deliver rich and personalized search experiences to your users.

Facets on Sharded Collections (coming soon in MongoDB 6.0)

Faceted search allows users to filter and quickly navigate search results by categories and see the total number of results per category for at-a-glance statistics. With the new facet operator, facet and count operations are pushed down into Atlas Search’s embedded Lucene index and processed locally — taking advantage of 20-plus years of Lucene optimizations — before returning the faceted result set back to the application.

What this means is that now facet-heavy workloads such as e-commerce product catalogs, content libraries, and counts run up to 100x faster than without Lucene-based facets. In MongoDB 6.0, facets will work on sharded collections and enable your biggest workloads to scale.

Search embedded documents in arrays

It can be difficult for developers to know what the shape of their data will look like in the future, but MongoDB’s flexible data model enables you to quickly adapt to unforeseen needs. Storing data in arrays is a common way of collecting attributes about objects like products, and the ability to accurately query data in those arrays is a necessity to deliver a great search user experience.

Atlas Search now enables you to query objects nested in arrays with indexing support for nested data types via the embeddedDocuments field type, now available in preview, helping you access the full benefits of a developer data platform purpose-built for modern multi-structured data and flexible, evolving schemas. To learn more about embedded documents in arrays, refer to the documentation.

Run Cross-Collection Searches: $search with $unionwith or $lookup

Atlas Search now enables the ability to use $unionWith and $lookup in a $search query to search across data in more than one MongoDB collection.

Using $search with $unionWith provides the ability to search across multiple collections in the same database for a word, phrase, or other criteria to return relevant documents with one query. For example, you can return all restaurant reviews that contain the word takeout across multiple collections. For more information, refer to the documentation.

Using $search with $lookup performs a join to an unsharded collection in the same database to filter in documents from the joined collection for processing, which is helpful for use cases like searching product reviews or orders. Refer to the documentation.

Faster aggregations with Stored Source Fields

By specifying the storedSource option in your Atlas Search index definition, you can deliver faster speeds for $search queries that use multiple aggregation stages (like $sort and $skip). With this performance optimization in place, you can build faster search experiences for your customers to discover and explore your data. To learn more about Stored Source Fields, refer to the documentation.

Get more insights with new Atlas Search Metrics

Seven additional metrics are now viewable in the Metrics tab for each of your clusters:

  • Search Disk Space Used: Total bytes of disk space that search indexes occupy.

  • Search Fields Indexed: Total number of unique fields present in the Atlas Search index.

  • Search Index Size: Total size of all indexes on disk in bytes.

  • Search JVM Heap Memory: Amount of memory that the JVM heap is currently using.

  • Search Max Replication Lag: Approximate number of milliseconds that Atlas Search is behind in replicating changes from the oplog of mongod.

  • Search Opcounters: Total number of Atlas Search operations

  • Search Query Status: Total number of Atlas Search queries with each status.

With this addition, you can now access additional data to help diagnose and analyze the impact of search on your database deployments (for example, monitoring the impact of your search index sizes on memory). For more information, refer to the documentation.

Control access with the new Project Search Index Editor Role in Atlas

Project Search Index Editor allows users with this role to perform search index–related CRUD operations without the ability to view or modify the underlying data or perform other project-level changes. That means that you can now grant team members the ability to configure Atlas Search indexes without worrying about introducing additional security or operational risk. To learn more, visit our Atlas User Roles Docs page.

Learn more about getting started with Atlas Search, see the documentation.