manage-indexes

For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!-- Tab options on this page. Append to the .md URL to filter: ?tabs=<id,...> select specific tabs (e.g. ?tabs=nodejs,shell) ?allTabs=true include every tab (no param) default: one tab per tabset

Available tabs: other tabs: fts-vs, data-explorer, vib, jsonib, create-one, create-multiple -->

Manage MongoDB Search Indexes

A MongoDB Search index is a data structure that maps documents from your Atlas cluster to the terms that are extracted from those documents. MongoDB Search indexes enable efficient full-text searches of your database with MongoDB Search queries.

This page describes how to create, view, update, or delete MongoDB Search indexes using the Atlas UI or one of our supported clients.

Supported Clients

You can create and manage MongoDB Search indexes from the Atlas UI or one of the following supported clients:

  • Atlas CLI, with Atlas cluster running MongoDB 7.0+

  • [mongosh](https://www.mongodb.com/docs/mongodb-shell.md#mongodb-binary-bin.mongosh, with Atlas cluster running MongoDB 7.0+.

  • Compass, with Atlas cluster running MongoDB 7.0+.

  • Supported MongoDB Drivers:

MongoDB Driver Driver Version
C 1.25.0 or higher
C++ 3.9.0 or higher
C# 2.21.0 or higher
Go 1.13.0 or higher
Java 4.11.0 or higher
Mongoid 9.0 or higher
Motor 3.3.0 or higher
Kotlin 5.2.0 or higher
Node 5.6.0 or higher
PHP 1.17.0 or higher
Python 4.5 or higher
Ruby 2.19.2 or higher
Rust 2.8.0 or higher
Scala 5.2.0 or higher

Required Access

You can assign [Project User Roles](https://www.mongodb.com/docs/atlas/reference/user-roles.md#std-label-project-roles or [Database Built-in User Roles](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#std-label-mongodb-users-roles-and-privileges to provide access to the user privileges necessary to perform the MongoDB Search index actions described in this guide:

  • The following table shows the modes of access that the following [Project User Roles](https://www.mongodb.com/docs/atlas/reference/user-roles.md#std-label-project-roles support for the specified MongoDB Search actions:
Project User Role MongoDB Search Action Atlas UI Atlas CLI Atlas API
[Project Data Access Read Only](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Data-Access-Read-Only or higher To view MongoDB Search indexes and analyzers. ✓ ✓
[Project Data Access Admin](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Data-Access-Admin or higher To create, view, update, and delete MongoDB Search indexes and analyzers. ✓ ✓ ✓
[Project Search Index Editor](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Search-Index-Editor To create, view, update, and delete MongoDB Search indexes. ✓ ✓ ✓

Each role grants permission to call either a subset or the full set of MongoDB Search API endpoints in the Atlas Administration API. See the MongoDB Search Action column for descriptions of the API endpoints that each role grants access to.

  • The following table shows the [Database Built-in User Roles](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#std-label-mongodb-users-roles-and-privileges that support the specified [MongoDB Search Index Privilege Actions.](https://www.mongodb.com/docs/manual/reference/privilege-actions/#atlas-search-index-actions
Database Built-in User Roles MongoDB Search Action Description MongoDB Search Index Privilege Action
[read](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-read or [readAnyDatabase](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-readAnyDatabase To view MongoDB Search indexes and analyzers. [listSearchIndexes](https://www.mongodb.com/docs/manual/reference/privilege-actions/#mongodb-authaction-listSearchIndexes
[readWrite](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-readWrite or [readWriteAnyDatabase](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-readWriteAnyDatabase To create, view, update, and delete MongoDB Search indexes and analyzers. [createSearchIndexes](https://www.mongodb.com/docs/manual/reference/privilege-actions/#mongodb-authaction-createSearchIndexes, [listSearchIndexes](https://www.mongodb.com/docs/manual/reference/privilege-actions/#mongodb-authaction-listSearchIndexes [updateSearchIndex](https://www.mongodb.com/docs/manual/reference/privilege-actions/#mongodb-authaction-updateSearchIndex, and [dropSearchIndex](https://www.mongodb.com/docs/manual/reference/privilege-actions/#mongodb-authaction-dropSearchIndex

To learn more, see [Built-In Roles](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#std-label-atlas-user-privileges or [Built-In Roles.](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#std-label-atlas-specific-privileges

Create a MongoDB Search Index

To create a MongoDB Search index using the Atlas UI:

  1. In Atlas, go to the Search & Vector Search page for your cluster.

You can go the MongoDB Search page from the Search & Vector Search option, or the Data Explorer.

### Search & Vector Search

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Search & Vector Search under the Database heading.

  • If you have no clusters, click Create cluster to create one. To learn more, see [Create an Atlas Infinite or Atlas Core Cluster.](https://www.mongodb.com/docs/atlas/tutorial/create-new-cluster.md#std-label-create-new-cluster

  • If your project has multiple clusters, select the cluster you want to use from the Select cluster dropdown, then click Go to Search.

The Search & Vector Search page displays.

  1. Click Create Search Index.

  2. Start your index configuration.

Make the following selections on the page and then click Next.

Search Type Select the MongoDB Search index type.
Index Name and Data Source Specify the following information: Index Name: default; Database and Collection:name of the database; name of the collection
Configuration Method For a guided experience, select Visual Editor.To edit the raw index definition, select JSON Editor.

IMPORTANT: The default index name varies by index type: your MongoDB Search index is named default, your Vector Search index is named vector_index, and your Automated Embedding index is named autoembed_index. If you are creating multiple indexes, we recommend that you maintain a consistent, descriptive naming convention across your indexes.

  1. Review the default MongoDB Search index configuration settings in the Index Configurations section.

The default index definition is a [dynamic mapping](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-static-dynamic-mappings of the fields in the documents and will work with any collection.

To customize your index definition, review the following index configurations:

### Visual Editor

Visual Editor Field Description Necessity
Index Analyzer Specify the [analyzer](https://www.mongodb.com/docs/search/indexes/analyzers/overview.md#std-label-analyzers-ref to use for indexing the collection data. By default, MongoDB Search uses the [standard](https://www.mongodb.com/docs/search/indexes/analyzers/standard.md#std-label-ref-standard-analyzer analyzer (lucene.standard). Corresponds to the analyzer JSON (Javascript Object Notation) setting. Optional
Search Analyzer Specifies the [analyzer](https://www.mongodb.com/docs/search/indexes/analyzers/overview.md#std-label-analyzers-ref to apply to query text before searching the text. If you omit this field, the index inherits an analyzer by default in the following order: The analyzer option for this field if specified.The searchAnalyzer option for the [index](https://www.mongodb.com/docs/search/indexes/index-definitions.md#std-label-ref-index-definitions if specified.The analyzer option for the [index](https://www.mongodb.com/docs/search/indexes/index-definitions.md#std-label-ref-index-definitions if specified.The lucene.standard analyzer. Corresponds to the searchAnalyzer JSON (Javascript Object Notation) setting. Optional
Dynamic Mapping Specify dynamic or static mapping of fields. By default, dynamic mapping is enabled. To disable dynamic mapping, set dynamic to Off. If you disable dynamic mapping, you must specify the fields to index. To learn more about dynamic and static mappings, see [Define Field Mappings for a MongoDB Search Index.](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-fts-field-mappings Corresponds to the mappings.dynamic JSON (Javascript Object Notation) setting. Required

If you are satisfied with the default configuration, skip ahead. If you wish to refine your MongoDB Search index, proceed to the next step.

  1. Refine your MongoDB Search index to configure additional settings.

### Visual Editor

Click Refine Your Index to make changes to any of the following settings.

Field Name Description Necessity
Field Mappings Required if Dynamic Mapping in the Index Configurations section is disabled. Specify the fields to index: Click Add Field Mapping to open the Add Field Mapping window.Specify the following information about the field:Field name - Name of the field to index.; Data Type - Field data type. To learn more about the supported data types and their options, see [MongoDB Search Field Types.](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-bson-data-chart(Optional) Specify additional properties.A table of additional configuration options appears in the Add Field Mapping window. These properties depend on the data type that you selected in the last step.To learn more about the supported data types and their options, see [MongoDB Search Field Types.](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-bson-data-chart(Optional) Add multi field.Click Add Multi Field to configure an alternative field analyzer with which to index the field. To learn more, see [Multi Analyzer.](https://www.mongodb.com/docs/search/indexes/analyzers/multi.md#std-label-ref-multi-analyzersClick Add to add the field.You can click the ellipses (...) icon for the field in the Actions column to do the following:Click Edit to modify the configuration.; Click Add Data Type to configure additional data types for the field.; Click Delete to remove the field from the index. To learn more about defining field mappings, see [Index Reference.](https://www.mongodb.com/docs/search/indexes/index-definitions.md#std-label-ref-index-definitions Corresponds to the mappings.fields JSON (Javascript Object Notation) setting. Conditional
Stored Source Fields Specify the fields to store on MongoDB Search for query-time lookups. You can store fields of all supported [MongoDB Search Field Types](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-bson-data-chart on MongoDB Search. To learn more about storing fields, see [Define Stored Source Fields in Your MongoDB Search Index.](https://www.mongodb.com/docs/search/indexes/stored-source-definition.md#std-label-fts-stored-source-definition Corresponds to the storedSource JSON (Javascript Object Notation) setting. Optional
Synonyms Mappings Specify synonym mappings to use in your index. You can use a synonym mapping to query only fields analyzed with the same analyzer. To learn more about synonym mappings, see [Define Synonym Mappings in Your MongoDB Search Index.](https://www.mongodb.com/docs/search/indexes/synonyms.md#std-label-synonyms-ref Corresponds to the synonyms JSON (Javascript Object Notation) setting. Optional.
Index Partitions The number of partitions to use if field objects exceed 2.1 billion. Corresponds to the numPartitions JSON (Javascript Object Notation) setting. Optional.

Click Save Changes.

  1. Optional. If you use the Visual Editor, you can save or delete your index definition draft.

IMPORTANT: You can't save the [default index definition](https://www.mongodb.com/docs/search/indexes/manage-indexes.md#std-label-fts-manage-indexes as a draft. If you use the Visual Editor and your index definition contains [static mappings](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-static-dynamic-mappings, you can save an index definition as a draft.

Click Cancel.

Click Save Draft or Delete Draft.

WARNING: You can't create a new index when you have a pending index draft.

To learn more, see [Resume or Delete a MongoDB Search Index Draft.](https://www.mongodb.com/docs/search/indexes/manage-indexes.md#std-label-ref-resume-index

  1. Click Create Search Index.

Atlas displays a Toast (brief, non-interactive notification) to let you know your index is building.

  1. Check the status.

The newly created index appears on the Atlas Search tab. While the index is building, the Status field reads Building. When the index is finished building, the Status field reads Ready.

IMPORTANT: Larger collections take longer to index. You will receive an email notification when your index is finished building.

View MongoDB Search Indexes

To view the Atlas UI MongoDB Search page:

  1. In Atlas, go to the Search & Vector Search page for your cluster.

You can go the MongoDB Search page from the Search & Vector Search option, or the Data Explorer.

###### Search & Vector Search

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Search & Vector Search under the Database heading.

If your project has multiple clusters, select the cluster you want to use from the Select cluster dropdown, then click Go to Atlas Search.

The Search & Vector Search page displays.

###### Data Explorer

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Data Explorer under the Database heading.

Expand the database and select the collection.

Click the Indexes tab for the collection.

Click the Search and Vector Search link in the banner.

The Search & Vector Search page displays.

The MongoDB Search page in the Atlas UI displays details about all of the MongoDB Search indexes on a cluster.

This page contains a table with the following details for each of your MongoDB Search indexes in each column:

Column Description
Database Name of the database that contains the collection.
Collection Name of the indexed collection.
Index Name Name of the index.
Status Status of the index on the primary node of the cluster. To learn more, see [MongoDB Search Index Statuses.](https://www.mongodb.com/docs/manual/reference/method/db.collection.getSearchIndexes.md#std-label-search-index-status
Queryable Icon that identifies whether collection is queryable using the index. Value can be one of the following icons: - for indexes that you can use to query the collection.; X - for indexes that you can't use to query the collection.
Type Type of index. Value can be one of the following types of index: search - for running [$search](https://www.mongodb.com/docs/search/query/aggregation-stages/search.md#mongodb-pipeline-pipe.-search and [$searchMeta](https://www.mongodb.com/docs/search/query/aggregation-stages/searchmeta.md#mongodb-pipeline-pipe.-searchMeta queries.; vectorSearch - for running [$vectorSearch](https://www.mongodb.com/docs/vector-search/query/aggregation-stages/vector-search-stage.md#mongodb-pipeline-pipe.-vectorSearch queries.
Index Fields Indexed fields. Value is dynamic if you enabled [dynamic mappings](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-static-dynamic-mappings. For [static mappings](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-static-dynamic-mappings, the column shows all of the indexed fields.
Documents Approximate number and percentage of indexed documents out of the total number of documents in the collection during and after the index build on the primary or search node on the cluster.
Size Size of the index.
Required Memory Approximate amount of memory required to run queries. Applies only to MongoDB Vector Search indexes.
Actions Actions you can take on the index: Click Query to go to the Search Tester for querying the collection.; Click and select one of the following actions to take on the index:[Edit](https://www.mongodb.com/docs/search/indexes/manage-indexes.md#std-label-ref-edit-index the index using the Visual Editor or JSON Editor.; [Delete](https://www.mongodb.com/docs/search/indexes/manage-indexes.md#std-label-ref-delete-index the index.

By default, Atlas sorts the indexes first by database name, then collection name. To sort by multiple columns, press Shift and click the column names according to the sort priority you want.

From this table, you can open the following pages for more details about each index:

Index Overview

To open the Index Overview page from the table on the MongoDB Search page, click the Index Name of the index that you want to view.

For each index, the Index Overview page shows the [namespace](https://www.mongodb.com/docs/manual/reference/limits/#std-label-faq-dev-namespace for the index and the following configurations specified in the index definition:

Row Description
Index Analyzer Chosen text analyzer that specifies how text is processed and tokenized when building the search index.
Search Analyzer Chosen text analyzer that specifies how text in your search queries is processed and tokenized.
Dynamic Mapping Boolean indicating whether or not you enabled [dynamic or static mappings](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-static-dynamic-mappings for your field mappings
Field Mappings Any specified [field mappings](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-fts-field-mappings, including field name, data type, and whether dynamic mapping is enabled for the individual field
Stored Source Fields Any defined [stored source fields](https://www.mongodb.com/docs/search/indexes/stored-source-definition.md#std-label-fts-stored-source-definition
Synonym Mappings Any defined [synonym mappings](https://www.mongodb.com/docs/search/indexes/synonyms.md#std-label-synonyms-ref for word equivalents

To learn how to view index status details from the MongoDB Search page, see [View MongoDB Search Index Statuses.](https://www.mongodb.com/docs/search/indexes/manage-indexes.md#std-label-fts-index-statuses

View MongoDB Search Index Statuses

The MongoDB Search page in the Atlas UI displays a table of the MongoDB Search indexes for a cluster. The Status column displays the status of the MongoDB Search index on the primary node in the cluster.

Possible index statuses include:

Status Description
Pending Atlas has not yet started building the index.
Building Atlas is building the index or re-building the index after an edit. When the index is in this state: For a new index, MongoDB Search doesn't serve queries until the index build is complete.; For an existing index, you can continue to use the old index for existing and new queries until the index rebuild is complete.
Ready Index is ready to use.
Stale Index is stale because of any of the following reasons: Replication stopped due to high disk utilization.For dedicated mongot nodes, the pause replication threshold is 90% and the resume replication threshold is 85% disk utilization. For colocated mongot nodes, the pause replication threshold is 96% and the resume replication threshold is 94% disk utilization.; If replication stops for a long period, the MongoDB Search mongot process falls off the oplog.This state commonly occurs when the current replication point is no longer available on the [mongod](https://www.mongodb.com/docs/manual/reference/program/mongod.md#mongodb-binary-bin.mongod oplog. Atlas rebuilds index if the mongot process falls off the oplog.; Index reached the two billion document limit.; Replication failed due to an error. You can still query the existing index. However, the results for queries against a stale index might contain stale data. You can upscale your search nodes for more disk space and delete existing indexes to release disk space. Alternatively, use the error in the View status details modal window to troubleshoot the issue. To learn more, see [Fix MongoDB Search Issues.](https://www.mongodb.com/docs/atlas/reference/alert-resolutions/atlas-search-alerts.md#std-label-atlas-search-alerts
Failed Atlas could not build the index. Use the error in the View status details modal window to troubleshoot the issue. To learn more, see [Fix MongoDB Search Issues.](https://www.mongodb.com/docs/atlas/reference/alert-resolutions/atlas-search-alerts.md#std-label-atlas-search-alerts
Deleting MongoDB is deleting the index from the cluster nodes.
Does not Exist Index is invalid because the collection for the index no longer exists. You can't run queries on this index because there is no corresponding collection for this index. Atlas will eventually delete the index.

To view index statuses for more nodes in your cluster, you can open the Status Details page by clicking View status details in the Status column.

The Status Details page contains the following sections:

Index Serving Queries

This section displays the index that is being used to serve queries.

If you have only one version of the index with this name for the collection, the section contains a link to the Index Overview where you can see the index definition for the index being used.

If you had other indexes with the same name on the collection, the section shows the latest index definition and also shows prior valid versions of the index that you can copy in different tabs.

When you update an index, different nodes apply the updates at different speeds. Therefore, some nodes might use the latest version and some might use the prior version. Atlas displays both versions of the index until the changes are applied to all the nodes.

If you attempt to update the index with an invalid index definition, the index build will fail and Atlas displays only the previous valid index definition.

Status Details by Node

This section displays the status of the index on each node of the cluster. You can see the following details about the index on each node:

Shard Shard name.
Node Node information.
Status Status of the index on the node in the shard.
Queryable Icon that indicates whether the index can serve queries.
Message Reason for the index status. For indexes in Stale or Failed state, displays the reason why the index is stale or why the index build failed.
Node Type Type of node. Value can be one of the following types: Primary; Secondary; Search Node
Region Node region.
Size Size of the index on the node.
Documents Number and percentage of indexed documents.
Actions Actions you can take on the index in the node. You can click the and select one of the following options: [View metrics.](https://www.mongodb.com/docs/atlas/review-atlas-search-metrics.md#std-label-review-atlas-search-metrics; Copy the host name of the node.

Migration to Search Nodes

This section displays the status of the in-progress migration of your MongoDB Search and MongoDB Vector Search indexes to search nodes, if applicable. This section displays only if you are currently migrating to search nodes.

Click the View Migration Progress link in the information banner under the Index Status by Search Node section for details on the progress of the migration of the indexes to Search Nodes (on a per node basis).

The Atlas UI displays the following columns for each index on the cluster.

Column Description
Database Name of the database that contains the collection.
Collection Name of the indexed collection.
Index Name Name of the index.
Index Fields Indexed fields. Value is dynamic if you enabled [dynamic mappings](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-static-dynamic-mappings. For [static mappings](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-static-dynamic-mappings, the column shows all of the indexed fields.
Type Type of index. Value can be one of the following types of index: search - for running [$search](https://www.mongodb.com/docs/search/query/aggregation-stages/search.md#mongodb-pipeline-pipe.-search and [$searchMeta](https://www.mongodb.com/docs/search/query/aggregation-stages/searchmeta.md#mongodb-pipeline-pipe.-searchMeta queries.; vectorSearch - for running [$vectorSearch](https://www.mongodb.com/docs/vector-search/query/aggregation-stages/vector-search-stage.md#mongodb-pipeline-pipe.-vectorSearch queries.
Status Status of the migration. To learn more, see [Migration to Search Nodes.](https://www.mongodb.com/docs/search/indexes/manage-indexes.md#std-label-search-node-migration-status
Size Size of the index.
Documents Number and percentage of indexed documents out of the total number of documents in the collection during and after the migration on the search nodes on the cluster.

The status column displays one of the following migration statuses of the index on the Search Nodes:

Status Description
Building The index is currently building on the Search Node. Your queries can continue to use existing indexes while the new index is building.
On Deck The index is successfully built on the Search Nodes, but the migration is not yet complete. Note that migration is complete only when Atlas successfully builds all the indexes on the Search Nodes.
Ready The index on the Search Node is ready for use in your queries. This displays only when Atlas successfully completes the migration to the Search Nodes.
Failed The index build failed and the migration to separate Search Nodes is stalled. Your queries can continue to use the existing indexes. Atlas will try to rebuild the index, but will timeout after 7 days. To migrate successfully, review error message for the index in the Message column of the Status Details by Node section in the Status Details page and address issues that are causing the index build to fail on the Search Nodes.

Your queries can continue to use existing indexes while the new indexes are building on the Search Nodes. The migration to the Search Nodes completes only when Atlas successfully builds all the indexes on the Search Nodes. Then, your queries are automatically routed to the use the indexes on the Search Nodes.

Important:

You can [resume a change stream](https://www.mongodb.com/docs/manual/changeStreams/#resume-a-change-stream only while the oplog collection still holds the operation that its [resume token](https://www.mongodb.com/docs/manual/changeStreams/#resume-tokens-from-change-events identifies. To ensure that your applications can resume their change streams, configure a [Minimum Oplog Window](https://www.mongodb.com/docs/atlas/cluster-additional-settings/#set-oplog-min-window longer than the longest interruption you expect.

Resume or Delete a MongoDB Search Index Draft

To resume or delete a MongoDB Search index definition that you saved as a draft in the Atlas UI:

WARNING: You can't create a new index when you have a pending index draft.

  1. In Atlas, go to the Search & Vector Search page for your cluster.

You can go the MongoDB Search page from the Search & Vector Search option, or the Data Explorer.

###### Search & Vector Search

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Search & Vector Search under the Database heading.

If your project has multiple clusters, select the cluster you want to use from the Select cluster dropdown, then click Go to Atlas Search.

The Search & Vector Search page displays.

###### Data Explorer

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Data Explorer under the Database heading.

Expand the database and select the collection.

Click the Indexes tab for the collection.

Click the Search and Vector Search link in the banner.

The Search & Vector Search page displays.

  1. Click Resume Index Creation.

  2. Save or delete your index definition draft.

Click Cancel.

Click Save Draft or Delete Draft.

  1. Customize your MongoDB Search index configuration settings.

Click Refine Your Index to make changes to your index configuration.

Click Save Changes.

  1. Click Create Search Index.

Atlas displays a Toast (brief, non-interactive notification) to let you know your index is building.

  1. Check the status.

The newly created index appears on the Atlas Search tab. While the index is building, the Status field reads Building. When the index is finished building, the Status field reads Ready.

IMPORTANT: Larger collections take longer to index. You will receive an email notification when your index is finished building.

Update and Rebuild an Existing MongoDB Search Index

Some MongoDB Search features require that you update the index. To update your index, you can take one of the following actions:

  • Edit the index definition using the steps in [Manage MongoDB Search Indexes.](https://www.mongodb.com/docs/search/indexes/manage-indexes.md#std-label-ref-edit-index

  • Do the following steps to opt-in for an index update from the Atlas UI:

Important:

If Atlas detects insufficient disk space to rebuild the index in place, it automatically provisions new nodes in the background, rebuilds the index, and swaps to the new index seamlessly.

  1. In Atlas, go to the Clusters page for your project.

If it's not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.

If it's not already displayed, select your desired project from the Projects menu in the navigation bar.

In the sidebar, click Clusters under the Database heading.

The Clusters page displays.

  1. In Atlas, go to the Search & Vector Search page for your cluster.

You can go the MongoDB Search page from the Search & Vector Search option, or the Data Explorer.

###### Search & Vector Search

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Search & Vector Search under the Database heading.

If your project has multiple clusters, select the cluster you want to use from the Select cluster dropdown, then click Go to Atlas Search.

The Search & Vector Search page displays.

###### Data Explorer

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Data Explorer under the Database heading.

Expand the database and select the collection.

Click the Indexes tab for the collection.

Click the Search and Vector Search link in the banner.

The Search & Vector Search page displays.

  1. Click the name of the index that you want to update.

WARNING: If an index requires an update to enable a new feature, the Atlas UI shows a warning icon next to the index name.

  1. Update your index to use the new feature.

In the Index Overview page, click Update in the banner.

Click Update Index in the confirmation window.

While your index is updating, you can continue to query your collection using your previous index.

Edit a MongoDB Search Index

You can edit a MongoDB Search index to change the [index definition](https://www.mongodb.com/docs/search/indexes/index-definitions.md#std-label-ref-index-definitions of an existing MongoDB Search index. You cannot rename an index; if you need to change an index's name, you must create a new index and delete the old one.

To edit a MongoDB Search index using the Atlas UI:

  1. In Atlas, go to the Search & Vector Search page for your cluster.

You can go the MongoDB Search page from the Search & Vector Search option, or the Data Explorer.

###### Search & Vector Search

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Search & Vector Search under the Database heading.

If your project has multiple clusters, select the cluster you want to use from the Select cluster dropdown, then click Go to Atlas Search.

The Search & Vector Search page displays.

###### Data Explorer

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Data Explorer under the Database heading.

Expand the database and select the collection.

Click the Indexes tab for the collection.

Click the Search and Vector Search link in the banner.

The Search & Vector Search page displays.

  1. Click and choose one of the following from the dropdown.

  2. Edit With Visual Editor for a guided experience.

  3. Edit With JSON Editor to edit the raw index definition.

  4. Review current configuration settings and edit them as needed.

### Visual Editor

Review the following index configuration settings:

Visual Editor Field Description Necessity
Index Analyzer Specify the [analyzer](https://www.mongodb.com/docs/search/indexes/analyzers/overview.md#std-label-analyzers-ref to use for indexing the collection data. By default, MongoDB Search uses the [standard](https://www.mongodb.com/docs/search/indexes/analyzers/standard.md#std-label-ref-standard-analyzer analyzer (lucene.standard). Corresponds to the analyzer JSON (Javascript Object Notation) setting. Optional
Search Analyzer Specifies the [analyzer](https://www.mongodb.com/docs/search/indexes/analyzers/overview.md#std-label-analyzers-ref to apply to query text before searching the text. If you omit this field, the index inherits an analyzer by default in the following order: The analyzer option for this field if specified.The searchAnalyzer option for the [index](https://www.mongodb.com/docs/search/indexes/index-definitions.md#std-label-ref-index-definitions if specified.The analyzer option for the [index](https://www.mongodb.com/docs/search/indexes/index-definitions.md#std-label-ref-index-definitions if specified.The lucene.standard analyzer. Corresponds to the searchAnalyzer JSON (Javascript Object Notation) setting. Optional
Dynamic Mapping Specify dynamic or static mapping of fields. By default, dynamic mapping is enabled. To disable dynamic mapping, set dynamic to Off. If you disable dynamic mapping, you must specify the fields to index. To learn more about dynamic and static mappings, see [Define Field Mappings for a MongoDB Search Index.](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-fts-field-mappings Corresponds to the mappings.dynamic JSON (Javascript Object Notation) setting. Required

Review the following advanced configuration settings:

Field Name Description Necessity
Field Mappings Required if Dynamic Mapping in the Index Configurations section is disabled. Specify the fields to index: Click Add Field Mapping to open the Add Field Mapping window.Specify the following information about the field:Field name - Name of the field to index.; Data Type - Field data type. To learn more about the supported data types and their options, see [MongoDB Search Field Types.](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-bson-data-chart(Optional) Specify additional properties.A table of additional configuration options appears in the Add Field Mapping window. These properties depend on the data type that you selected in the last step.To learn more about the supported data types and their options, see [MongoDB Search Field Types.](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-bson-data-chart(Optional) Add multi field.Click Add Multi Field to configure an alternative field analyzer with which to index the field. To learn more, see [Multi Analyzer.](https://www.mongodb.com/docs/search/indexes/analyzers/multi.md#std-label-ref-multi-analyzersClick Add to add the field.You can click the ellipses (...) icon for the field in the Actions column to do the following:Click Edit to modify the configuration.; Click Add Data Type to configure additional data types for the field.; Click Delete to remove the field from the index. To learn more about defining field mappings, see [Index Reference.](https://www.mongodb.com/docs/search/indexes/index-definitions.md#std-label-ref-index-definitions Corresponds to the mappings.fields JSON (Javascript Object Notation) setting. Conditional
Stored Source Fields Specify the fields to store on MongoDB Search for query-time lookups. You can store fields of all supported [MongoDB Search Field Types](https://www.mongodb.com/docs/search/indexes/define-field-mappings.md#std-label-bson-data-chart on MongoDB Search. To learn more about storing fields, see [Define Stored Source Fields in Your MongoDB Search Index.](https://www.mongodb.com/docs/search/indexes/stored-source-definition.md#std-label-fts-stored-source-definition Corresponds to the storedSource JSON (Javascript Object Notation) setting. Optional
Synonyms Mappings Specify synonym mappings to use in your index. You can use a synonym mapping to query only fields analyzed with the same analyzer. To learn more about synonym mappings, see [Define Synonym Mappings in Your MongoDB Search Index.](https://www.mongodb.com/docs/search/indexes/synonyms.md#std-label-synonyms-ref Corresponds to the synonyms JSON (Javascript Object Notation) setting. Optional.
Index Partitions The number of partitions to use if field objects exceed 2.1 billion. Corresponds to the numPartitions JSON (Javascript Object Notation) setting. Optional.
  1. Click Save to apply the changes.

The index's status changes from Active to Building. In this state, you can continue to use the old index because MongoDB Search does not delete the old index until the updated index is ready for use. Once the status returns to Active, the modified index is ready to use.

Note:

While your updated index is building, different nodes might update at varying speeds. During this period, you might experience mixed query results, reflecting both the new index definition and the previous index definition.

Delete a MongoDB Search Index

Warning: Deleting Search Indexes and Clusters Is Irreversible

Deleting Search indexes and associated clusters is a permanent action. MongoDB doesn't provide support for recovering deleted Search indexes or data. Ensure that you have taken appropriate measures, such as creating backups, to avoid data loss before proceeding.

MongoDB doesn't support requests to recover deleted Search indexes or data. You are responsible for data integrity and configurations.

To delete a MongoDB Search index using the Atlas UI:

  1. In Atlas, go to the Search & Vector Search page for your cluster.

You can go the MongoDB Search page from the Search & Vector Search option, or the Data Explorer.

### Search & Vector Search

If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

If it's not already displayed, select your project from the Projects menu in the navigation bar.

In the sidebar, click Search & Vector Search under the Database heading.

  • If you have no clusters, click Create cluster to create one. To learn more, see [Create an Atlas Infinite or Atlas Core Cluster.](https://www.mongodb.com/docs/atlas/tutorial/create-new-cluster.md#std-label-create-new-cluster

  • If your project has multiple clusters, select the cluster you want to use from the Select cluster dropdown, then click Go to Search.

The Search & Vector Search page displays.

  1. Click the ... button.

The ellipsis button is located on the right side of the panel. Click the button beside you

(本文超出站点单文档体积上限,已截断)