Docs Menu

Docs HomeMongoDB Atlas

Edit an Atlas Search Index

On this page

  • Permissions required
  • Edit an Atlas Search Index Using the Atlas UI
  • Edit an Atlas Search Index Using the Atlas Search API
  • Edit an Atlas Search Index Using the Atlas CLI

You can change the index definition of an existing Atlas 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.

The following table shows the modes of access each role supports.

Role
Action
Atlas UI
Atlas API
Atlas Search API
Atlas CLI
To view Atlas Search analyzers and indexes.
To create and manage Atlas Search analyzers and indexes, and assign the role to your API Key.
To create access list entries for your API Key and send the request from a client that appears in the access list for your API Key.
To create, view, edit, and delete Atlas Search indexes using the Atlas UI or API.
1

Click Databases in the top-left corner of Atlas to navigate to the Database Deployments page for your project.

2
3
4
  • Edit with Visual Editor for a guided experience.

    Note

    The Visual Editor doesn't support custom analyzers or synonym mapping definitions.

  • Edit with JSON Editor to edit the raw index definition.

5
  • If you are using the Visual Editor, configure the following settings:

    Field Name
    Description
    Necessity
    Index Analyzer

    Specify the analyzer to use for indexing the collection data. By default, Atlas Search uses the standard analyzer ("lucene.standard").

    Corresponds to the analyzer setting.

    Optional
    Search Analyzer

    Specify the analyzer to use when parsing data for the Atlas Search queries. By default, Atlas Search uses the standard analyzer ("lucene.standard").

    Corresponds to the searchAnalyzer setting.

    Optional
    Dynamic Mapping

    Specify dynamic or static mapping of fields. To disable dynamic mapping, set "dynamic": to Off. By default, dynamic mapping is enabled. If you disable dynamic mapping, you must specify the fields to index. To learn more about dynamic and static mappings, see Review Atlas Search Index Syntax.

    Corresponds to the mappings.dynamic setting.

    Required
    Store Full Document

    Specify whether to store entire documents on Atlas Search. If this is enabled, Atlas Search stores all the fields in the documents by default. You can exclude specific fields from storage on Atlas Search in the Field Mappings definition for the fields. To learn more about storing fields, see Define Stored Source Fields in Your Atlas Search Index.

    Required
    Field Mappings

    Required if dynamic mapping is disabled.

    To add the fields to index, you must specify the following settings for each field:

    • Field name - Name of the field to index.

    • Enable Dynamic Mapping - Static or dynamic mapping to use. If you disable dynamic mapping, the data in the field isn't automatically indexed.

    • Store Original Value - Flag to store field on Atlas Search. This is enabled by default if Store Full Document is enabled. However, you can toggle the setting to Off to exclude the field from storage. To learn more about storing fields, see Define Stored Source Fields in Your Atlas Search Index.

    • Data Type Configuration - Field data type. To learn more about the supported data types and their options, see BSON Data Types and Atlas Search Field Types.

    Note

    Unlike compound indexes, the order of fields in the Atlas Search index definition is not important. Fields can be defined in any order.

    Corresponds to the mappings.fields setting.

    Conditional
    Synonyms Mappings

    Specify synonym mappings to use in your index. To learn more, see Define Synonym Mappings in Your Atlas Search Index.

    To add synonym mappings, you must specify the following settings for each synonym:

    • Synonym mapping name - Label that identifies the synonym mapping to refer to at query time. You must specify a unique value. You can't specify an empty string value.

    • Synonym source collection - Label that identifies the MongoDB collection in the same database as the Atlas Search index. Documents in this collection use the format described in the Synonyms Source Collection Documents. You can also add an empty collection or load a sample collection.

    • Analyzer - Label that identifies the analyzer to use with this synonym mapping.

      Note

      You can use a synonym mapping to query only fields analyzed with the same analyzer. By default, Atlas Search uses the standard analyzer ("lucene.standard").

      You can specify any Atlas Search analyzer except the following Language analyzers:

      • lucene.kuromoji

      • lucene.cjk

      Custom analyzer tokenizers and token filters:

    Corresponds to the synonyms setting.

    Optional.
  • If you are using the JSON Editor, configure the following settings:

    Field Name
    Description
    Necessity
    analyzer

    Specify the analyzer to use for indexing the collection data. By default, Atlas Search uses the standard analyzer ("lucene.standard").

    Optional
    searchAnalyzer

    Specify the analyzer to use when parsing data for the Atlas Search queries. By default, Atlas Search uses the standard analyzer ("lucene.standard").

    Optional
    mappings.dynamic

    Specify dynamic or static mapping of fields. To disable dynamic mapping, set "dynamic": to false. By default, dynamic mapping is enabled. If you disable dynamic mapping, you must specify the fields to index. To learn more about dynamic and static mappings, see Review Atlas Search Index Syntax.

    Required
    mappings.fields

    Required if dynamic mapping is disabled.

    Specify the fields that you would like to index. To learn more, see Define Field Mappings.

    Note

    Unlike compound indexes, the order of fields in the Atlas Search index definition is not important. Fields can be defined in any order.

    Conditional
    storedSource

    Note

    storedSource is only available on Atlas clusters running one of the following versions:

    • MongoDB 4.4.12+

    • MongoDB 5.0.6+

    • MongoDB 6.0+

    Specify fields in the documents to store for query-time look-ups using the returnedStoredSource option. Value can be one of the following:

    • true, to store all fields

    • false, to not store any fields

    • Object that specifies the fields to include or exclude from storage

    If omitted, defaults to false. To learn more about the syntax and fields, see Define Stored Source Fields in Your Atlas Search Index.

    Note

    You can store fields of all BSON Data Types on Atlas Search.

    Optional
    synonyms

    Specify synonym mappings to use in your index. To learn more, see Define Synonym Mappings in Your Atlas Search Index.

    Note

    You can use a synonym mapping to query only fields analyzed with the same analyzer. By default, Atlas Search uses the standard analyzer ("lucene.standard").

    Optional
6

The index's status changes from Active to Building. In this state, you can continue to use the old index because Atlas 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.

To edit an Atlas Search index through the API, send a PATCH request with the ID of the Atlas Search index that you wish to modity to the fts/indexes/ endpoint. To learn more about the syntax and parameters for this endpoint, see Update One.

To update a search index for a cluster using the Atlas CLI, run the following command:

atlas clusters search indexes update <indexId> [options]

To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas clusters search indexes update.

Tip

See: Related Links

←  View an Atlas Search IndexDelete an Atlas Search Index →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.