Docs Menu

인덱스 참조

An Atlas Search index is a data structure that maps documents from your Atlas cluster to the terms that are extracted from those documents. Atlas Search indexes enable efficient full-text searches of your database.

When you define an Atlas Search index, you can use static or dynamic mappings to specify which fields you want to index in your collection. You can also use analyzers to define how Atlas Search extracts searchable tokens from string fields or query strings. Finally, you can apply additional configuration options in your index definition to improve the performance and accuracy of your Atlas Search query, including options to store source fields in your index, or define synonym mappings.

To learn how to define an Atlas Search index according to your your query requirements, see Atlas Search 인덱스 만들기. Once you define your Atlas Search index, you can add the index to your Atlas cluster with the Atlas Search 인덱스 만들기 tutorial. To learn how to view, edit, update, or delete your Atlas Search index, see Atlas Search 인덱스 관리.

This page describes the JSON syntax and definition options for an Atlas Search index.

1{
2 "mappings": {
3 "dynamic": <boolean>,
4 "fields": { <field-definition> }
5 }
6}
7
1{
2 "analyzer": "<analyzer-for-index>",
3 "searchAnalyzer": "<analyzer-for-query>",
4 "mappings": {
5 "dynamic": <boolean>,
6 "fields": { <field-definition> }
7 },
8 "numPartitions": <integer>,
9 "analyzers": [ <custom-analyzer> ],
10 "storedSource": <boolean> | {
11 <stored-source-definition>
12 },
13 "synonyms": [
14 {
15 <synonym-mapping-definition>
16 }
17 ]
18}
19
필드
유형
필요성
설명

analyzer

문자열

옵션

인덱싱할 때 문자열 필드에 적용할 분석기를 지정합니다.

이 옵션을 맨 위에만 설정하고 인덱스 정의에서 필드에 대한 분석기를 지정하지 않으면 Atlas Search에서 이 분석기를 모든 필드에 적용합니다. 각 필드에 대해 다른 분석기를 사용하려면 해당 필드에 다른 분석기를 지정해야 합니다.

지정하지 않으면 기본적으로 표준 분석기가 사용됩니다.

analyzers

옵션

이 인덱스에서 사용할 사용자 지정 분석기를 지정합니다.

mappings

필수 사항

이 인덱스에 대해 서로 다른 경로에서 필드를 인덱싱하는 방법을 지정합니다.

mappings.dynamic

부울

옵션

이 인덱스에 대한 필드의 동적 매핑을 사용하거나 사용하지 않도록 설정합니다.

true로 설정하면 Atlas Search는 동적으로 인덱싱할 수 있는 모든 필드를 재귀적으로 인덱싱합니다.

false로 설정하면 mappings.fields를 사용하여 인덱싱할 개별 필드를 지정해야 합니다.

생략하는 경우 기본값은 false입니다.

중요: Atlas Search는 감지된 데이터 유형에 대한 기본 설정을 사용하여 document의 모든 필드를 동적으로 인덱싱합니다. dynamicfalse로 설정하여 명시적으로 재정의하지 않는 한, Atlas Search는 document 아래에 있는 모든 중첩된 문서도 동적으로 인덱싱합니다.

인덱스 구성의 예시는 정적 매핑 예시 또는 결합된 매핑 예시를 참조하세요.

mappings.fields

문서

조건부

인덱싱할 필드를 지정합니다. 동적 매핑이 비활성화된 경우에만 필요합니다.

필드 이름 시작 부분에 달러($) 기호가 포함된 필드는 인덱싱할 수 없습니다.

자세한 내용은 필드 매핑 정의를 참조하세요.

searchAnalyzer

문자열

옵션

검색하기 전에 쿼리 텍스트에 적용할 분석기를 지정합니다.

지정하지 않으면 analyzer 옵션에 지정한 분석기가 기본값으로 사용됩니다. searchAnalyzeranalyzer 옵션을 모두 지정하지 않으면 기본값은 표준 분석기로 설정됩니다.

numPartitions

int

옵션

문서 수가 20억 개를 초과하는 경우 생성할 하위 인덱스의 수를 지정합니다. 유효한 값은 1, 2, 4입니다. 생략하면 기본값은 1입니다.

인덱스 파티션을 사용하려면 클러스터 에 검색 노드가 배포되어 있어야 합니다.

storedSource

옵션

returnedStoredSource 옵션을 사용하여 쿼리 시간 조회를 위해 저장할 문서 내 필드를 지정합니다. Atlas Search에서 모든 데이터 유형의 필드를 저장할 수 있습니다. 값은 다음 중 하나일 수 있습니다.

  • true, 모든 필드를 저장하려는 경우

  • false, 어떤 필드도 저장하지 않으려는 경우

  • 스토리지에서 include 또는 exclude으로 필드를 지정하는 객체입니다.

storedSource은(는) 다음 버전 중 하나를 실행하는 Atlas 클러스터에서만 사용할 수 있습니다.

  • MongoDB 5.0.6+

  • MongoDB 6.0+

  • MongoDB 7.0+

생략하는 경우 기본값은 false입니다.

자세히 알아보려면 Atlas Search 인덱스에 저장된 소스 필드 정의를 참조하세요.

synonyms

옵션

인덱스에 사용할 동의어 매핑입니다.

인덱스 정의에는 동의어 매핑이 하나만 있을 수 있습니다.

자세한 내용은 Atlas Search 인덱스에서 동의어 매핑 정의를 참조하세요.

Atlas Search mongot 프로세스가 설치되어 있지 않거나 실행 중이 아닌 상태에서 $search 쿼리를 실행하면 다음 오류가 반환됩니다.

MongoError: Remote error from mongot :: caused by :: Error connecting to localhost:28000.

mongot 프로세스는 첫 번째 Atlas Search 검색 인덱스가 정의된 경우에만 설치됩니다. Atlas cluster에 Atlas Search 검색 인덱스가 없는 경우 Atlas Search 검색 인덱스를 하나 이상 생성하여 이 오류를 해결합니다.

To learn how to define an Atlas Search index to meet your Atlas Search query needs, see Atlas Search 인덱스 만들기.

To learn how to add an index to your Atlas cluster, see Atlas Search 인덱스 만들기.

To learn more about the available index configuration options, see the following reference pages: