- Manage Deployments >
- Create Indexes
Create Indexes¶
On this page
Overview¶
Ops Manager Automation lets you build MongoDB indexes without downtime for your deployment. The Automation Agent will sequentially take each individual node in a replica set or cluster offline to build the indexes. The agent builds the indexes without increasing load on your deployment or blocking read or write operations. You can create any type of MongoDB index. For available types, see Index Types in the MongoDB manual.
Warning
The Automation Agent does not currently support automated removal of an index from a collection. To remove an index that is managed by the Automation Agent, you must first remove the index from Automation and then manually remove the index from the collection. See the Remove an Index procedures below.
Procedures¶
Create an Index¶
Warning
To include the new index in any backups of the MongoDB instances, you must resync backups after performing this procedure.
Click the Deployment tab, then click the Deployment page.¶
Click the first of the two Processes icons.¶
On the line listing the deployment item, click the wrench icon.¶
A deployment item can be a sharded cluster or replica set.
Expand the Index Configuration section.¶
If the Index Configuration section is not visible, collapse the open sections above it, such as Cluster Configuration or Replica Set Configuration. Or just scroll down to the Index Configuration section
Click Add and select the type of index.¶
Select one of the following:
Index | An index on one or more fields. You can create indexes of any of the types described in the MongoDB manual. |
TTL Index | A single-field index that MongoDB can use to automatically remove documents from a database that stores transient information, such as logs. For more information, see the TTL Indexes in the MongoDB manual. |
Configure the index.¶
Enter the following information, according to index type, and click Add:
Database and Collection |
The index applies to the specified collection in the specified database. |
Field | The field to index. For a regular index you can specify multiple fields using the add another link. The order of the fields is important. See Compound Indexes in the MongoDB manual for more information. For a TTL index you must specify a data field. TTL indexes expire documents after the specified number of seconds has passed since the indexed field value. |
Value Index only |
Specifies either the sort order or index type. For more information on sort order, see the Index Introduction and Compound Indexes sections of the MongoDB manual. For more information on index types, see the following in the MongoDB manual:
|
Expiration TTL Index only |
The number of seconds to wait after field value before removing the document. The expiration time is the field value plus the specified number of seconds. |
Unique Index only |
A unique index rejects documents that contain a duplicate value for the indexed field. For more information, see the Unique Indexes in the MongoDB manual. |
Sparse Index only |
Sparse indexes only contain entries for documents that have the indexed field, even if the index field contains a null value. The index skips over any document that is missing the indexed field. For more information, see the Sparse Indexes in the MongoDB manual. |
2d min/max Index only |
Stores the coordinates for a 2d index. |
bucketSize Index only |
Stores the size of the buckets for a geoHaystack index. For more information on bucket size, see Create a Haystack Index in the MongoDB manual. |
Click Apply.¶
Click Review & Deploy.¶
Click Confirm & Deploy.¶
Remove an Index¶
Click the Deployment tab, then click the Deployment page.¶
Click the first of the two Processes icons.¶
On the line listing the deployment item, click the wrench icon.¶
A deployment item can be a sharded cluster or replica set.
Expand the Index Configuration section.¶
If the Index Configuration section is not visible, collapse the open sections above it, such as Cluster Configuration or Replica Set Configuration. Or just scroll down to the Index Configuration section