Fix This Page
Navigation
You were redirected from a different version of the documentation. Click here to go back.

Create Indexes

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.

Create an Index

Note

MongoDB backups automatically include any indexes you create using Ops Manager.

1

Click Deployment, then the Processes tab, then the Topology view.

2

On the line for the sharded cluster or replica set, click Modify.

3

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

4

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.
5

Configure the index.

Enter the following information:

Note

The available fields depend on the type of index you chose in the previous step.

Database and Collection The collection to which the index applies. Specify both the database and the collection.
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

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 For a TTL index, the number of seconds to wait after the date specified in the indexed field before removing the document. The expiration time is the field value plus the specified number of seconds.
Unique A unique index rejects documents that contain a duplicate value for the indexed field or fields. For more information, see the Unique Indexes in the MongoDB manual.
Sparse 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 Stores the coordinates for a 2d index.
bucketSize 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.
Collation Options The collation options (Locale, Case Level, ... etc.) let you specify the language-specific rules to use when sorting and matching strings. For more information on the collation options, see Collation in the MongoDB manual.
6

Click Add

7

Click Apply.

8

Click Review & Deploy.

9

Click Confirm & Deploy.

Remove an Index

1

Click Deployment, then the Processes tab, then the Topology view.

2

On the line listing the deployment item, click Modify.

A deployment item can be a sharded cluster or replica set.

3

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

4

Unmanage the index.

Do the following:

  1. For the selected index, click Unmanage
  2. Click Confirm.
  3. Click Apply.
  1. Click Review & Deploy.
  2. Click Confirm & Deploy.
5

Manually remove the index.

Manually remove the index as described in Remove Indexes in the MongoDB manual.