You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/community-search/quick-start/README.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ This command checks the `mongodb-kubernetes-database-pods` service account to co
130
130
131
131
With the prerequisites and initial setup complete, you can now deploy MongoDB Community Edition and enable Search.
132
132
133
-
### 1. Create MongoDB User Secrets
133
+
### 6. Create MongoDB User Secrets
134
134
135
135
MongoDB requires authentication for secure access. This step creates two Kubernetes secrets: `admin-user-password` and `search-user-password`. These secrets store the credentials for the MongoDB administrative user and a dedicated search user, respectively. These secrets will be mounted into the MongoDB pods.
Ensure these secrets are created in the same namespace where you plan to deploy MongoDB.
148
148
149
-
### 2. Create MongoDB Community Resource
149
+
### 7. Create MongoDB Community Resource
150
150
151
151
Now, deploy MongoDB Community by creating a `MongoDBCommunity` custom resource named `mdbc-rs`. This resource definition instructs the MongoDB Kubernetes Operator to configure a MongoDB replica set with 3 members, running version 8.0.6. MongoDB Community Search is supported only from MongoDB Community Server version 8.0. It also defines CPU and memory resources for the `mongod` and `mongodb-agent` containers, and sets up two users (`admin-user` and `search-user`) with their respective roles and password secrets. User `search-user` will be used to restore, connect and perform search queries on the `sample_mflix` database.
152
152
@@ -209,7 +209,7 @@ spec:
209
209
EOF
210
210
```
211
211
212
-
### 3. Wait for MongoDB Community Resource to be Ready
212
+
### 8. Wait for MongoDB Community Resource to be Ready
213
213
214
214
After applying the `MongoDBCommunity` custom resource, the operator begins deploying the MongoDB nodes (pods). This step uses `kubectl wait` to pause execution until the `mdbc-rs` resource's status phase becomes `Running`, indicating that the MongoDB Community replica set is operational.
kubectl --context "${K8S_CLUSTER_0_CONTEXT_NAME}" -n "${MDB_NAMESPACE}" get pods
224
224
```
225
225
226
-
### 4. Create MongoDB Search Resource
226
+
### 9. Create MongoDB Search Resource
227
227
228
228
Once your MongoDB deployment is ready, enable Search capabilities by creating a `MongoDBSearch` custom resource, also named `mdbc-rs` to associate it with the MongoDB instance. This resource specifies the CPU and memory resource requirements for the search nodes.
229
229
@@ -261,7 +261,7 @@ requests:
261
261
memory: 2G
262
262
```
263
263
264
-
### 5. Wait for Search Resource to be Ready
264
+
### 10. Wait for Search Resource to be Ready
265
265
266
266
Similar to the MongoDB deployment, the Search deployment needs time to initialize. This step uses `kubectl wait` to pause until the `MongoDBSearch` resource `mdbc-rs` reports a `Running` status in its `.status.phase` field, indicating that the search nodes are operational and integrated.
This command polls the status of the `MongoDBSearch` resource `mdbc-rs`.
274
274
275
-
### 6. Verify MongoDB Community Resource Status
275
+
### 11. Verify MongoDB Community Resource Status
276
276
277
277
Double-check the status of your `MongoDBCommunity` resource to ensure it remains healthy and that the integration with the Search resource is reflected if applicable.
This provides a final confirmation that the core database is operational.
285
285
286
-
### 7. List Running Pods
286
+
### 12. List Running Pods
287
287
288
288
View all the running pods in your namespace. You should see pods for the MongoDB replica set members, the MongoDB Kubernetes Operator, and the MongoDB Search nodes.
Now that your MongoDB Community database with Search is deployed, you can start using its search capabilities.
303
303
304
-
### 1. Deploy MongoDB Tools Pod
304
+
### 13. Deploy MongoDB Tools Pod
305
305
306
306
To interact with your MongoDB deployment, this step deploys a utility pod named `mongodb-tools-pod`. This pod runs a MongoDB Community Server image and is kept running with a `sleep infinity` command, allowing you to use `kubectl exec` to run MongoDB client tools like `mongosh` and `mongorestore` from within the Kubernetes cluster. Running steps in a pod inside the cluster simplifies connectivity to mongodb without neeeding to expose the database externally (provided steps directly connect to the *.cluster.local hostnames).
307
307
@@ -329,7 +329,7 @@ echo "Waiting for the mongodb-tools to be ready..."
To test the search functionality, this step imports the `sample_mflix.movies` collection. It downloads the sample dataset and uses `mongorestore` to load the data into the `sample_mflix` database in your MongoDB deployment, connecting as the `search-user`.
335
335
@@ -347,7 +347,7 @@ EOF
347
347
```
348
348
This command uses `mongoimport` from the `mongodb-tools-pod` to load data from the downloaded `sample_mflix.archive` file.
349
349
350
-
### 3. Create Search Index
350
+
### 15. Create Search Index
351
351
352
352
Before performing search queries, create a search index. This step uses `kubectl exec` to run `mongosh` in the `mongodb-tools-pod`. It connects to the `sample_mflix` database as `search-user` and calls `db.movies.createSearchIndex()` to create a search index named "default" with dynamic mappings on the `movies` collection. Dynamic mapping automatically indexes all fields with supported types. MongoDB Search offers flexible index definitions, allowing for dynamic and static field mappings, various analyzer types (standard, language-specific, custom), and features like synonyms and faceted search.
Creating a search index is an asynchronous operation. This script polls periodically the status by executing `db.movies.getSearchIndexes("default")`.
367
367
@@ -389,7 +389,7 @@ if [[ "${search_index_status}" != "READY" ]]; then
389
389
fi
390
390
```
391
391
392
-
### 5. Execute a Search Query
392
+
### 17. Execute a Search Query
393
393
394
394
Once the search index is ready, execute search queries using the `$search` aggregation pipeline stage. MongoDB Search supports a query language, allowing for various types of queries such as text search, autocomplete, faceting, and more. You can combine `$search` with other aggregation stages to further refine and process your results.
Copy file name to clipboardExpand all lines: docs/community-search/quick-start/README.md.j2
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ This command checks the `mongodb-kubernetes-database-pods` service account to co
76
76
77
77
With the prerequisites and initial setup complete, you can now deploy MongoDB Community Edition and enable Search.
78
78
79
-
### 1. Create MongoDB User Secrets
79
+
### 6. Create MongoDB User Secrets
80
80
81
81
MongoDB requires authentication for secure access. This step creates two Kubernetes secrets: `admin-user-password` and `search-user-password`. These secrets store the credentials for the MongoDB administrative user and a dedicated search user, respectively. These secrets will be mounted into the MongoDB pods.
82
82
@@ -86,7 +86,7 @@ MongoDB requires authentication for secure access. This step creates two Kuberne
86
86
```
87
87
Ensure these secrets are created in the same namespace where you plan to deploy MongoDB.
88
88
89
-
### 2. Create MongoDB Community Resource
89
+
### 7. Create MongoDB Community Resource
90
90
91
91
Now, deploy MongoDB Community by creating a `MongoDBCommunity` custom resource named `mdbc-rs`. This resource definition instructs the MongoDB Kubernetes Operator to configure a MongoDB replica set with 3 members, running version 8.0.6. MongoDB Community Search is supported only from MongoDB Community Server version 8.0. It also defines CPU and memory resources for the `mongod` and `mongodb-agent` containers, and sets up two users (`admin-user` and `search-user`) with their respective roles and password secrets. User `search-user` will be used to restore, connect and perform search queries on the `sample_mflix` database.
92
92
@@ -95,7 +95,7 @@ Now, deploy MongoDB Community by creating a `MongoDBCommunity` custom resource n
### 3. Wait for MongoDB Community Resource to be Ready
98
+
### 8. Wait for MongoDB Community Resource to be Ready
99
99
100
100
After applying the `MongoDBCommunity` custom resource, the operator begins deploying the MongoDB nodes (pods). This step uses `kubectl wait` to pause execution until the `mdbc-rs` resource's status phase becomes `Running`, indicating that the MongoDB Community replica set is operational.
101
101
@@ -104,7 +104,7 @@ After applying the `MongoDBCommunity` custom resource, the operator begins deplo
Once your MongoDB deployment is ready, enable Search capabilities by creating a `MongoDBSearch` custom resource, also named `mdbc-rs` to associate it with the MongoDB instance. This resource specifies the CPU and memory resource requirements for the search nodes.
110
110
@@ -129,7 +129,7 @@ requests:
129
129
memory: 2G
130
130
```
131
131
132
-
### 5. Wait for Search Resource to be Ready
132
+
### 10. Wait for Search Resource to be Ready
133
133
134
134
Similar to the MongoDB deployment, the Search deployment needs time to initialize. This step uses `kubectl wait` to pause until the `MongoDBSearch` resource `mdbc-rs` reports a `Running` status in its `.status.phase` field, indicating that the search nodes are operational and integrated.
135
135
@@ -139,7 +139,7 @@ Similar to the MongoDB deployment, the Search deployment needs time to initializ
139
139
```
140
140
This command polls the status of the `MongoDBSearch` resource `mdbc-rs`.
141
141
142
-
### 6. Verify MongoDB Community Resource Status
142
+
### 11. Verify MongoDB Community Resource Status
143
143
144
144
Double-check the status of your `MongoDBCommunity` resource to ensure it remains healthy and that the integration with the Search resource is reflected if applicable.
145
145
@@ -149,7 +149,7 @@ Double-check the status of your `MongoDBCommunity` resource to ensure it remains
149
149
```
150
150
This provides a final confirmation that the core database is operational.
151
151
152
-
### 7. List Running Pods
152
+
### 12. List Running Pods
153
153
154
154
View all the running pods in your namespace. You should see pods for the MongoDB replica set members, the MongoDB Kubernetes Operator, and the MongoDB Search nodes.
155
155
@@ -162,7 +162,7 @@ View all the running pods in your namespace. You should see pods for the MongoDB
162
162
163
163
Now that your MongoDB Community database with Search is deployed, you can start using its search capabilities.
164
164
165
-
### 1. Deploy MongoDB Tools Pod
165
+
### 13. Deploy MongoDB Tools Pod
166
166
167
167
To interact with your MongoDB deployment, this step deploys a utility pod named `mongodb-tools-pod`. This pod runs a MongoDB Community Server image and is kept running with a `sleep infinity` command, allowing you to use `kubectl exec` to run MongoDB client tools like `mongosh` and `mongorestore` from within the Kubernetes cluster. Running steps in a pod inside the cluster simplifies connectivity to mongodb without neeeding to expose the database externally (provided steps directly connect to the *.cluster.local hostnames).
168
168
@@ -171,7 +171,7 @@ To interact with your MongoDB deployment, this step deploys a utility pod named
To test the search functionality, this step imports the `sample_mflix.movies` collection. It downloads the sample dataset and uses `mongorestore` to load the data into the `sample_mflix` database in your MongoDB deployment, connecting as the `search-user`.
177
177
@@ -181,7 +181,7 @@ To test the search functionality, this step imports the `sample_mflix.movies` co
181
181
```
182
182
This command uses `mongoimport` from the `mongodb-tools-pod` to load data from the downloaded `sample_mflix.archive` file.
183
183
184
-
### 3. Create Search Index
184
+
### 15. Create Search Index
185
185
186
186
Before performing search queries, create a search index. This step uses `kubectl exec` to run `mongosh` in the `mongodb-tools-pod`. It connects to the `sample_mflix` database as `search-user` and calls `db.movies.createSearchIndex()` to create a search index named "default" with dynamic mappings on the `movies` collection. Dynamic mapping automatically indexes all fields with supported types. MongoDB Search offers flexible index definitions, allowing for dynamic and static field mappings, various analyzer types (standard, language-specific, custom), and features like synonyms and faceted search.
187
187
@@ -190,7 +190,7 @@ Before performing search queries, create a search index. This step uses `kubectl
Once the search index is ready, execute search queries using the `$search` aggregation pipeline stage. MongoDB Search supports a query language, allowing for various types of queries such as text search, autocomplete, faceting, and more. You can combine `$search` with other aggregation stages to further refine and process your results.
0 commit comments