Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
Click here >
Docs Menu
Docs Home
/ /
/ / /

MongoDB Search Architecture

MongoDB Search enables full-text search capabilities in your Kubernetes environment by deploying the mongot process alongside your MongoDB database deployment (mongod). The mongot process manages search indexes, sources data from the database, and processes $search and $searchMeta queries. This eliminates the need to maintain separate search systems while providing advanced search features.

To deploy MongoDB Search, you apply the MongoDBSearch Custom Resource (CR), which the Kubernetes Operator picks up and uses to deploy mongot pods and request persistent storage specified in the spec.

For deployment procedures, see Deploy MongoDB Search and Vector Search.

Each mongot process has its own persistent volume that is not shared with the database or other search nodes. Storage is used to maintain indexes that are built from the data continuously sourced from the database. The index definitions (metadata) are stored in the database itself.

The mongot performs the following actions:

  • Manages the index.

    The mongot is responsible for updating the index definitions in the database.

  • Sources the data from the database.

    The mongot nodes establish permanent connections to the database in order to update indexes from the database in real time.

  • Processes search queries.

    When mongod receives a $search or $searchMeta query, it directs the query to one of the mongot nodes. The mongot that receives the query processes the query, aggregates the data, and returns the results to mongod, which forwards the results to the user.

The mongot components are tightly coupled with a single MongoDB replica set and cannot be shared across multiple databases or replica sets. Each replica set deployment has its own dedicated search nodes. To learn more about Search node architecture, see Node Architecture in the MongoDB Search documentation.

Network connectivity between mongot and mongod goes in both directions:

  • mongot establishes connections to the replica set to source the data used to build indexes and run queries.

  • mongod connects to mongot to forward search-related operations such as index management and querying the data.

The mongod acts as the proxy for all search queries. You never interact directly with the mongot.

When both the mongot and mongod processes are deployed inside the Kubernetes cluster, the Kubernetes Operator performs configuration for both processes automatically. Specifically, the Kubernetes Operator:

  1. Finds the MongoDB CR referenced by MongoDBSearch using spec.source.mongodbResourceRef, or by a naming convention by looking for the MongoDB CR with the same name as MongoDBSearch.

  2. Generates mongot configuration in a YAML file and saves it to a config map named <MongoDBSearch.metadata.name>-search-config.

  3. Deploys the MongoDB Search stateful set named <MongoDBSearch.metadata.name>-search with storage and resource requirements configured according to spec.persistence and spec.resourceRequirements in the CR.

  4. Updates configuration of every mongod process by adding the necessary setParameter options, including the hostnames and port numbers of the mongot hosts.

When the MongoDB replica set is outside of Kubernetes, you deploy mongot using the Kubernetes Operator and perform some steps manually. The Kubernetes Operator handles configuration of the search pods, but you must reconfigure your MongoDB nodes and the networking.

If the MongoDB server is inside the Kubernetes cluster, the Kubernetes Operator automatically sets up keyfile authentication for MongoDB Search. If the MongoDB server is external, you must create a Kubernetes Secret containing the replica set's keyfile credential and reference it in the MongoDBSearch CR.

You can't deploy MongoDB Search on the following architectures:

  • IBM Power (ppc64le)

  • IBM Z (s390x)

Tip

Back

Multi-Cluster Architecture

On this page