Docs Menu
Docs Home
/
Atlas

Auto-Index Creation for Performance Advisor

Auto-index creation for Performance Advisor periodically checks for index recommendations and automatically creates indexes deemed to have a high impact on cluster performance.

You can enable auto-index creation if your cluster meets all of the following criteria:

  • Runs MongoDB 5.0 or later.

  • Uses tiers M10 and M30 (inclusive).

  • Does not run as a sharded cluster.

Auto-index creation prioritizes creating indexes with the highest Impact score. Atlas defines impact as the estimated performance improvement that the index would bring.

To learn more about the Impact score and how the Performance Advisor ranks indexes, see Review Index Ranking.

Performance Advisor doesn't show individual index recommendations by default. Performance Advisor shows the number of index recommendations per impact level (high and medium). To view the individual indexes that the auto-index creation would create, click View Recommendations. Atlas only creates high-impact indexes automatically.

Auto-index creation defaults to off. You can enable auto-index creation for your cluster through either the Atlas console or Atlas Administration API.

To enable auto-index creation for your cluster:

  1. Open Performance Advisor.

  2. In the Create Indexes panel, toggle Auto-Index Creation to on.

If you click View Recommendations, you can enable auto-index creation from the individual recommendations view.

Once you enable auto-index creation, Atlas begins creating high-impact indexes if Atlas suggests them.

To create a new cluster with auto-index creation enabled, send a request to the Create One Cluster endpoint.

To enable auto-index creation on an existing cluster, send a request to the Modify One Cluster endpoint.

The request body must set the autoScaling.autoIndexingEnabled field to true.

The following example request creates a new single region cluster with auto-index creation enabled:

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
--header "Content-Type: application/json" \
--include \
--request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters?pretty=true" \
--data '
{
"name": "SingleRegionCluster",
"autoScaling": {
"autoIndexingEnabled": true
}
"diskSizeGB": 100,
"numShards": 1,
"providerSettings": {
"providerName": "AWS",
"diskIOPS": 300,
"instanceSizeName": "M40",
"regionName": "US_EAST_1"
},
"clusterType" : "REPLICASET",
"replicationFactor": 3,
"replicationSpecs": [{
"numShards": 1,
"regionsConfig": {
"US_EAST_1": {
"analyticsNodes": 0,
"electableNodes": 3,
"priority": 7,
"readOnlyNodes": 0
}
},
"zoneName": "Zone 1"
}],
"backupEnabled": false,
"providerBackupEnabled" : true,
"autoScaling": {
"diskGBEnabled": true
}
}'

Atlas sends an email alert when it creates an index automatically. You can view automatically created indexes from the Atlas UI Indexes view. The Atlas UI shows automatically created indexes with the Auto-Created property.

You can drop auto-created indexes as you would any other index. To drop an auto-created index, click Drop Index. If you drop an auto-created index, auto-index creation doesn't recreate that index. Performance Advisor might still recommend that index.

Next

What is MongoDB Atlas?

On this page