Docs Menu

Docs HomeStart with Guides

Build a Dynamic Index

In this guide, you will learn how to create a search index for relevance-based search as an alternative to document-based search.

Time required: 15 minutes

1
2
sample-data-cluster
3

Click the Collections tab.

sample-data-tab
4
1

In the right-hand pane, click sample_supplies, then click the sales collection.

2

Click Search Indexes in the upper right of the collection preview pane.

3

Click Create Search Index.

4

Click the Visual Editor configuration method, then click Next.

5

Review the Database and Collection list to ensure that sample_supplies.sales is selected, then click Next.

5

Click QUERY in the Actions column of your index definition.

6
1

Type notepad into the search bar, then click Search.

2

Your results should include the fields listed in 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.

3

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
15 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
Share Feedback
© 2023 MongoDB, Inc.

About

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