Skip to main content

Create Atlas Search indexes

MongoDB's Atlas Search is a full-text search solution built on top of Apache Lucene. Atlas Search allows fine-grained text indexing and querying of data persisted in your Atlas database.

To start using Atlas Search, you must configure a search index on your database. Atlas Search indexes categorize data in an easily searchable format and enable faster document retrieval using certain identifiers. You can create a search index right from the Atlas UI.

Step-by-step guide to creating your first Atlas Seach index

  1. Open the Database Deployments page in MongoDB Atlas and select Create Index in the lower right corner.

    The 'Database Deployments' page with the 'Create Index' link highlighted
  2. Click the Create Search Index button.

    The 'Search' section of the cluster details page with the 'Create Search Index' button highlighted
  3. The first step of building the search index is selecting the configuration method. You can choose from two options — using the Visual Editor or writing the configuration yourself with the JSON Editor. Let's stick to the default Visual Editor. To proceed, click Next.

    The 'Configuration Method' step of creating a new search index
  1. Next, you need to select a name and data source for your index. Leave the name default and select the database soccer and the collection players.

    The 'Name & Data Source' step of creating a new search index
  2. The final step allows you to review the index configuration and refine it if needed. You may also see the JSON that was generated from your configuration by clicking View JSON.

    {
    "mappings": {
    "dynamic": true
    }
    }
    info

    The index is using dynamic field mappings. We didn't configure any explicit (static) mappings between the fields in the documents and the search index. That's why Atlas created dynamic mappings that match the data in the documents to some common field types such as double, string, array, int, and double. Dynamic mappings are useful when you're just getting started with Atlas Search or if your schema changes regularly. However, they take up more space compared to static mappings.

  3. You don't need to refine this index. Go ahead and click Create Search Index.

    The 'Review & Refine' step of creating a new search index
  4. You'll be redirected to a page showing all of the search indexes used in your Atlas project. Creating the index should take up to a minute.

    info

    When your search index reaches status Active, you'll be able to see more information about the index. For example, the number of indexed documents, the field mappings and the index size. Notice also that you're using 1 out of the 3 free search indexes that come with your free M0 database.

    List with search indexes