동적 인덱스 빌드하기
개요
In this guide, you will learn how to create an Atlas Search index with dynamic mappings to query and quickly retrieve relevant data.
소요 시간: 5분
준비물
MongoDB 계정 MongoDB 계정 가입을 참조하세요.
Atlas 클러스터 클러스터 생성을 참조합니다.
클러스터에 로드된 샘플 데이터 세트입니다.
절차
Navigate to the Database Deployments page for your project.
Create a dynamic search index.
Create Search Index를 클릭합니다.
Select the Visual Editor configuration method, then click Next.
Database and Collection 의 경우 sample_supplies
데이터베이스와 sales
컬렉션을 선택합니다. 그런 다음 Next 를 클릭합니다.
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.
Run a query on your index.
Click Query in the Actions column of your index definition.
Type notepad
into the search bar, then click Search.
This query returns all documents in the sales
collection with a field that contains notepad
.
Review the results.
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.
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.