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
Open the Database Deployments page in MongoDB Atlas and select Create Index in the lower right corner.
Click the Create Search Index button.
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.
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 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
}
}infoThe 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
, anddouble
. 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.You don't need to refine this index. Go ahead and click Create Search Index.
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.
infoWhen 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.