Docs Menu
Docs Home
/
MongoDB Atlas
/

Create and Manage Atlas Search Indexes

On this page

  • Supported Clients
  • Next Steps

An Atlas Search index is a data structure that categorizes data in an easily searchable format. It is a mapping between terms and the documents that contain those terms. Atlas Search indexes enable faster retrieval of documents using certain identifiers. You must configure an Atlas Search index to query data in your Atlas cluster using Atlas Search.

You can create an Atlas Search index on a single field or on multiple fields. We recommend that you index the fields that you regularly use to sort or filter your data in order to quickly retrieve the documents that contain the relevant data at query-time.

You can specify the fields to index using the following methods:

  • Dynamic mappings, which enables Atlas Search to automatically index all the fields of supported types in each document. This might waste disk space to index fields that you would never search and negatively impact cluster performance.

  • Static mappings, which allows you to selectively identify the fields to index. If fields contain polymorphic data, Atlas Search indexes only documents that correspond to the mapping in the index definition and ignores documents that contain values that don't correspond to the mapping specified in the index definition for the fields.

Although the data stored on Atlas Search isn't an identical copy of data from the collection on your Atlas cluster, Atlas Search indexes still take some disk space and memory. If you enable the store option for fields that contain string values or if you configure the stored source fields in your index, Atlas Search stores an identical copy of the specified fields on disk, which can take disk space.

Note

Atlas Search doesn't support encrypting Atlas Search indexes with encryption keys using Customer Key Management in the Atlas UI.

Atlas Search provides built-in analyzers for creating indexable terms that correct for differences in punctuation, capitalization, stop words, and more. Analyzers apply parsing and language rules to the query. You can also create a custom analyzer using available built-in character filters, tokenizers, and token filters. To learn more about the built-in and custom analyzers, see Process Data with Analyzers.

To learn more about Atlas Search support for other data types, see Data Types. The mongot process stores the indexed fields and the _id field on disk per index for the collections on the cluster.

If you make changes to the collection for which you defined Atlas Search indexes, the latest data might not be available immediately for queries. However, mongot monitors the change streams, which allows it to update stored copies of data, and Atlas Search indexes are eventually consistent.

When you change an index definition, mongot automatically rebuilds the new index in the background, while continuing to serve queries with the old index to make sure there is no downtime. This happens when you deploy mongot and mongod processes on the same node and when you deploy the processes on different nodes.

If you change the topology of your search deployment, Atlas Search provisions and builds indexes on any new nodes before removing old nodes, to ensure there is no query downtime.

If deployments where both the mongod and mongot processes run on the same node, when Atlas Search introduces changes that require rebuilding your indexes (such as some Atlas Search features that require an index update), Atlas automatically deploys additional nodes for free to build the indexes, while the old nodes continue to serve your queries.

Note

For Dedicated Search Nodes

Adding and adjusting shards triggers a rebuild of the Atlas Search index. During this index rebuild, the index might not have the most current data. Therefore, queries against data on those shards might fail or return incorrect results.

If you reshard a collection with Atlas Search indexes,|fts| indexes on the collection become unavailable when the resharding operation completes. You must delete and create new Atlas Search indexes once the operation is complete.

If you issue the command to change the primary shard of a database, the Atlas Search indexes for any unsharded collection under this database become unavailable once the operation completes. You must delete and create new Atlas Search indexes once the movePrimary operation is complete.

Prefer to learn by watching?

Watch this video for an overview of Atlas Search indexes. In this video, you can learn more about analyzers and Atlas Search autocomplete field type.

Duration: 8 Minutes

You can create and manage Atlas Search indexes from the Atlas UI, Atlas Search API, Atlas CLI, mongosh, MongoDB Compass, and MongoDB drivers.

To create and manage Atlas Search indexes using the Atlas CLI, your Atlas cluster must run MongoDB 6.0+ or 7.0+.

To create and manage Atlas Search indexes using mongosh, your Atlas cluster must run MongoDB 6.0+ or 7.0+.

To create and manage Atlas Search indexes using Compass, your Atlas cluster must run MongoDB 7.0+.

To create and manage Atlas Search indexes programmatically on any cluster tier, you can use any of the following MongoDB Drivers:

MongoDB Driver
Version

1.25.0 or higher

3.9.0 or higher

2.21.0 or higher

1.13.0 or higher

4.11.0 or higher

9.0 or higher

3.3.0 or higher

5.2.0 or higher

5.6.0 or higher

1.17.0 or higher

4.5 or higher

2.19.2 or higher

2.8.0 or higher

5.2.0 or higher

To learn how to create an Atlas Search index, see Create an Atlas Search Index. For hands-on experience creating Atlas Search indexes for the sample datasets and running Atlas Search queries against the indexed data, try the tutorials in the following pages:

Back

Hybrid Search