You can install the search process, mongot, in MongoDB Community Edition. The search process is available for deployment as an image in Docker. The mongot process supports full-text search and semantic search with your own embeddings or automated embeddings.
Install MongoDB Search and Vector Search with Docker
Note
To onboard more quickly with a deployment meant for experimentation, see the following tutorials for Self-Managed deployments:
Before You Begin
Before you deploy mongot, you must complete the following steps:
Install Docker and Docker Compose.
If you want MongoDB Vector Search to automatically generate embeddings for text data in your collection, create endpoint service API keys. To learn more, see Automated Embedding.
Important
Automated Embedding is in Preview. The feature and corresponding documentation might change at any time during the Preview period. To learn more, see Preview Features.
If you don't already have the keys, create the endpoint service API keys from the Atlas UI. We recommend that you create two keys, one for generating embeddings at index-time and another for generating embeddings at query-time, from two Atlas projects.
Note
Your provider endpoint for generating embeddings depends on whether you create the API keys from the Atlas UI or directly from Voyage AI.
Procedure
Warning
This procedure provides a simple and insecure default configuration that does not enable access control. The steps create a deployment intended for local experimentation only.
Before exposing these containers and using your setup in production, see the following resources to secure your deployment:
Download the MongoDB Docker image.
To download the MongoDB Docker image, run the following command:
docker pull mongodb/mongodb-community-server:latest
Note
You must have a minimum of MongoDB 8.2+ to use MongoDB Search with an on-prem deployment. For more information, see MongoDB Search Compatibility.
For additional details on installing MongoDB with Docker, see Install MongoDB Community with Docker.
Create a mongot sync-user password file.
Create a password file for mongot to connect to mongod.
For example, select your operating system and replace <mongot_password> with your password. Then, run the following command to create a file called passwordFile:
echo -n "<mongot_password>" > passwordFile chmod 400 passwordFile
Note
The -n flag prevents a trailing newline.
Create your mongod configuration file.
To create your configuration file, save the following code to mongod.conf or your preferred location.
# MongoDB Configuration File # Network configuration net: port: 27017 bindIpAll: true # Equivalent to --bind_ip_all # Replica set configuration replication: replSetName: rs0 # Search configuration parameters setParameter: # Server parameters to advise mongod of mongot availability for search index management and querying searchIndexManagementHostAndPort: mongot-community.search-community:27028 mongotHost: mongot-community.search-community:27028 skipAuthenticationToSearchIndexManagementServer: false useGrpcForSearch: true searchTLSMode: disabled
Start your mongod.
To start the mongod:
Replace
<your_admin_username>with the username you want to specify for your admin user.Replace
<your_admin_password>with the password you want to specify for your admin user.Replace
</path/to/data/db>with the path to the local directory for the mounted volume.Replace
</path/to/mongod.conf>with the path to the configuration file you created above.
docker run --rm \ --name mongod \ -v </path/to/mongod.conf>:/etc/mongod.conf:ro \ -v </path/to/data/db>:/data/db \ -p 27017:27017 \ --network search-community \ mongodb/mongodb-community-server:latest \ --config /etc/mongod.conf \ --replSetMember=mongod.search-community:27017
Create a user for the mongot process on your MongoDB deployment.
mongot must be able to connect to your MongoDB deployment through a user with the searchCoordinator role.
Run the following command to connect to the admin database:
use admin
To create a user with the searchCoordinator role:
Replace
<your-mongot-username>with a username for yourmongotuser.Replace
<your-mongot-password>with the password that you specified in yourpasswordFilein step 5.Run the following command:
db.createUser( { user: "<mongot_username>", pwd: "<mongot_password>", roles: [ "searchCoordinator" ] } )
For more information on creating users, see Create a User on Self-Managed Deployments.
Specify your search configuration options.
You can configure mongot with a YAML configuration file. You must specify the username that you specified in the previous step as the syncSource.replicaSet.username. You must also specify the passwordFile that you created in the previous step as the syncSource.replicaSet.passwordFile.
For more information on mongot configuration options, see mongot Options.
For example, you can adapt the settings to your local configuration as shown below:
# mongot.conf syncSource: replicaSet: hostAndPort: "mongod.search-community:27017" scramAuth: username: "mongotUser" passwordFile: "/passwordFile" authSource: "admin" tls: enabled: false replicationReader: readPreference: "secondaryPreferred" storage: dataPath: "/data/mongot" server: grpc: address: "mongot-community.search-community:27028" tls: mode: "disabled" metrics: enabled: true address: "mongot-community.search-community:9946" healthCheck: address: "mongot-community.search-community:8080" logging: verbosity: INFO
Save your file to mongot.config or your preferred file location.
Both containers run on the same search-community Docker network.
Start the mongot process.
To start the Search in Community binary, mongot:
Replace
</path/to/data/mongot>with the path to the local directory for the mounted volume to storemongotdata.Replace
</path/to/mongot.conf>with the path to themongotconfiguration file that you created in the previous step.Replace
</path/to/passwordFile>with the path to the password file you created.
docker run --rm \ --name mongot-community \ -v </path/to/data/mongot>:/data/mongot \ -v </path/to/mongot.conf>:/mongot-community/config.default.yml \ -v </path/to/passwordFile>:/passwordFile:ro \ --network search-community \ -p 8080:8080 \ -p 9946:9946 \ mongodb/mongodb-community-search:latest
This command:
Mounts the volume.
Mounts a configuration file from a local volume.
Specifies the port range.
Exposes the metrics port.
Starts the container on the
search-communityDocker network with a container namedmongot-community.
Verify the health of the mongot process.
To verify, send a request by using a HTTP client or curl to the /health endpoint. For example, send a curl request similar to the following sample request:
curl localhost:8080/health
The endpoint returns one of the following in the response:
SERVING, if themongotprocess is runningmongotmight not serve queries as it doesn't check the status of the indexes, which must be inReadystate to serve queries.NOT_SERVING, if themongotprocess isn't running
For more information, see Verify Your mongot Connection.
Uninstall MongoDB Search and MongoDB Vector Search with Docker
To completely remove MongoDB Search and MongoDB Vector Search from a system, remove the container image, the configuration files, and any data or log directories. The following section guides you through the necessary steps.
Drop the mongotUser user.
To drop the mongotUser user, run the following commands:
use admin db.dropUser("mongotUser")
For details, see db.dropUser().
Next Steps
Create MongoDB Search indexes