Docs Menu
Docs Home
/
Start with Guides

Build a Dynamic Index

In this guide, you will learn how to create an Atlas Search index with dynamic mappings to query and quickly retrieve relevant data.

Time required: 5 minutes

  • A MongoDB account. See Sign Up for a MongoDB Account.

  • An Atlas cluster. See Create a Cluster.

  • Sample datasets loaded into your cluster.

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

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

  3. If it's not already displayed, click Clusters in the sidebar.

    The Clusters page displays.

2
sample-data-cluster
click to enlarge
3
1
  1. Click the cluster's name.

  2. Click the Atlas Search tab.

    The Atlas Search page displays.

2

Click Create Search Index.

3

Select the Visual Editor configuration method, then click Next.

4

For the Database and Collection, select the sample_supplies database and the sales collection. Then, click Next.

5

Click Create Search Index to confirm your selection. Wait for the Status column to read Active.

You now have a search index that dynamically indexes the fields across the documents in your collection.

4
1

Click Query in the Actions column of your index definition.

2

Type notepad into the search bar, then click Search.

This query returns all documents in the sales collection with a field that contains notepad.

3

Your results should resemble the following sample documents:

SCORE: 0.20185701549053192
salesDate: 2013-03-07T09:27:58.283+00:00
items: Array
storeLocation: "Austin"
SCORE: 0.20185701549053192
salesDate: 2013-05-05T19:03:06.358+00:00
items: Array
storeLocation: "London"
SCORE: 0.20185701549053192
salesDate: 2016-06-20T14:09:52.408+00:00
items: Array
storeLocation: "Denver"

Each record also includes a relevance score. You can expand Array and Object fields to view their contents by clicking on them.

4

Click Edit Query Syntax. The modal window displays the query sent through the Atlas Search API.

If you successfully completed the procedure in this guide, you have created an Atlas Search index with dynamic field mappings and used it to perform a relevance-based query against the sample_supplies.sales collection. In the next guide, you will learn how to perform a refined search by creating an index with static field mappings.

What's Next
Build an Index with Static Field Mappings
5 mins

Retrieve documents in MongoDB with a field-specific query.

Start Guide
Chapter 3
Atlas Search
  • Build a Dynamic Index
  • Build an Index with Static Field Mappings
  • Querying with the Compound Operator
  • Querying with Facets