AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.

How to Index Fields for Automated Embedding

인터페이스

You can use the autoEmbed type on all cluster tiers to index text fields for automated embedding. When you index a field as the autoEmbed type, MongoDB Search uses the Voyage AI embedding model that you specify to generate vector embeddings for the text in the source field.

You can use the vectorSearch operator in your $search aggregation pipeline to query fields indexed as the autoEmbed type. You can combine the query with a lexical prefilter on other fields in the same index.

옵션
유형
필요성
설명

type

문자열

필수 사항

이 토크나이저 유형을 식별하는 사람이 읽을 수 있는 레이블입니다. 값은 autoEmbed이어야 합니다.

modality

문자열

필수 사항

Type of data in the source field. Value must be text.

model

문자열

필수 사항

임베딩 생성에 사용할 Voyage AI 임베딩 모델입니다. 다음 모델 중 하나를 지정할 수 있습니다.

  • voyage-4-lite

  • voyage-4

  • voyage-4-large

  • voyage-code-4

  • voyage-code-3

To learn more, see Automated Embedding Models.

numDimensions

Int

옵션

Number of vector dimensions that MongoDB Search enforces at index-time and query-time. You can specify one of the following values:

  • 256

  • 512

  • 1024

  • 2048

생략하면 기본값은 1024 벡터 차원입니다.

similarity

문자열

옵션

상위 K-최근접 이웃을 검색하는 데 사용하는 벡터 유사성 함수입니다. 다음 값 중 하나를 지정할 수 있습니다.

  • euclidean - 벡터의 끝과 끝 사이의 거리를 측정합니다.

  • cosine - 벡터 사이의 각도를 기준으로 유사성을 측정합니다.

  • dotProduct - cosine와(과) 같이 유사성을 측정하지만 벡터의 크기를 고려합니다.

If omitted, the default depends on the quantization value:

  • dotProduct for float and scalar

  • euclidean for binary and binaryNoRescore

자세한 학습 은 유사성 함수 정보를 참조하세요.

quantization

문자열

옵션

임베딩을 저장 데 사용할 데이터 유형입니다. 다음 값 중 하나를 지정할 수 있습니다.

  • float - float(4 바이트) 벡터 값을 사용하여 인덱스를 빌드합니다.

  • scalar - 스칼라(1 바이트) 벡터 값을 사용하여 인덱스를 빌드합니다.

  • binary - 이진(1 비트) 벡터 값으로 인덱스를 빌드하고 부동 소수점(전체 정밀도) 벡터 값을 사용하여 다시 점수를 매깁니다.

  • binaryNoRescore - 이진 벡터 값으로 인덱스를 빌드합니다. binary (재채점을 통한 이진 양자화)에 비해 이 옵션은 쿼리 속도를 높이고 저장 비용을 낮추지만 정확도는 낮습니다.

생략하면 기본값은 scalar 양자화입니다. 자세한 내용은 양자화 소개를 참조하세요.

indexingMethod

문자열

옵션

벡터 필드 의 인덱스 구조입니다. 값은 다음과 같습니다.

  • hnsw - 유사한 벡터가 연결된 그래프 기반 인덱스 의 경우

  • flat - 플랫, 그래프가 아닌 인덱스 의 경우

생략하면 기본값은 hnsw입니다. 자세한 학습은 인덱싱 방법 정보 를 참조하세요.

hnswOptions.

객체

옵션

Parameters to use for Hierarchical Navigable Small Worlds graph construction. This is mutually exclusive with the flat indexing method. If omitted, uses the default values for the maxEdges and numEdgeCandidates parameters.

NOTE: We recommend using the default values. Specify hnswOptions only if you are experiencing suboptimal recall on large indexes. While higher values provide better recall, they also increase memory usage and slow down indexing and search speed.

자세한 학습은 인덱싱 메서드 정보를 참조하세요.

hnswOptions.
maxEdges

Int

옵션

Hierarchical Navigable Small Worlds 그래프에서 노드가 가질 수 있는 최대 간선(또는 연결) 수입니다. 값은 16 에서 64 사이일 수 있으며 둘 다 포함합니다. 생략하면 기본값은 16입니다. 예시 16 들어 값의 경우, 각 노드 Hierarchical Navigable Small Worlds 그래프 의 각 레이어에서 나가는 가장자리를 최대 16개 가질 수 있습니다.

A higher number improves recall (accuracy of search results) because the graph is better connected. However, this slows down query speed because of the number of neighbors to evaluate per graph node, increases the memory for the Hierarchical Navigable Small Worlds graph because each node stores more connections, and slows down indexing because MongoDB Search evaluates more neighbors and adjusts for every new node added to the graph.

hnswOptions.
numEdgeCandidates

Int

옵션

쿼리 시 numCandidates와 유사하게, 이 매개변수는 새 노드에 연결할 가장 가까운 노드를 찾기 위해 평가할 최대 노드 수를 제어합니다. 값은 100~ 3200일 수 있으며, 두 값 모두 포함됩니다. 이를 생략하는 경우 기본값은 100입니다.

숫자가 높을수록 고품질 연결을 가진 그래프가 제공되어 검색 품질(재현율)을 향상시킬 수 있지만, 쿼리 지연 시간에 부정적인 영향을 미칠 수도 있습니다.

참고

The Atlas UI JSON Editor schema validation doesn't recognize the indexingMethod and hnswOptions fields for the autoEmbed type and might flag them as errors. You can still save an index definition that includes these fields.

The following index definitions use the sample_mflix.movies collection in the sample data. After you load the collection, you can use the following examples to index the plot field for automated embedding.

다음과 같은 제한 사항이 적용됩니다:

  • You can't use a field name that begins with _autoEmbed at the top level of the index mappings. This namespace is reserved for internal use.

  • You can't enable dynamic mappings at any level in index definitions that contain the autoEmbed type. This applies when you create or update the index. Use static mappings instead.

  • You can't use the autoEmbed type in a typeSet definition. To learn which types a type set accepts, see Configure a typeSet.

  • You can't use storedSource in index definitions that contain the autoEmbed type.

  • You can't index fields inside an embeddedDocuments type field as the autoEmbed type. You can index fields inside a document type field as the autoEmbed type.

  • You can't specify a path option in an autoEmbed type field definition. The field name in the index mappings identifies the source field. For example, MongoDB Search rejects the following fields mapping:

    { "title": { "type": "autoEmbed", "path": "title", "model": "voyage-4", "modality": "text" }}
  • You can't declare the same source path for more than one autoEmbed type field. This includes a literal dotted field name, such as parent.child, and the same path nested inside a document type field. For example, MongoDB Search rejects the following fields mapping:

    { "parent.child": { "type": "autoEmbed", "model": "voyage-4-lite", "modality": "text" }, "parent": { "type": "document", "dynamic": false, "fields": { "child": { "type": "autoEmbed", "model": "voyage-4", "modality": "text" } } }}

    To index the nested field, remove the parent.child field and keep only the nested document type definition:

    { "parent": { "type": "document", "dynamic": false, "fields": { "child": { "type": "autoEmbed", "model": "voyage-4", "modality": "text" } } }}
  • You can't remove all autoEmbed type fields from an index.

  • You can't index a source field as the autoEmbed type and as the document, embeddedDocuments, or geo type at the same path. You can index a source field as the autoEmbed type and as a scalar type, such as string or token, at the same path. For example, the following fields mapping indexes the plot field as both the token type and the autoEmbed type:

    { "plot": [ { "type": "token" }, { "type": "autoEmbed", "model": "voyage-4", "modality": "text" } ]}

    For a complete example, see Index the Source Field as Multiple Types.

  • You can't sort on a field that you index as the autoEmbed type.

  • You can't create an index for the autoEmbed type from the Atlas UI Visual Editor. Instead, use the JSON Editor.

  • If your index definition contains an autoEmbed type field, the exists operator might not match documents on a field that you declare without a type, such as "b": []. MongoDB Search doesn't carry declarations that add no type into the index that it builds for automated embedding. For example, the following fields mapping declares the b field without a type:

    { "a": { "type": "document", "dynamic": false, "fields": { "b": [], "c": { "type": "autoEmbed", "model": "voyage-4", "modality": "text" } } }}

    Because the b field declaration adds no type, the index that MongoDB Search builds for automated embedding doesn't record a.b. As a result, an exists query on a.b might not match a document such as { "a": { "b": "x" } }. Without the autoEmbed type field, the same query matches the document.

    To make exists queries match, declare a type for the field. For example, replace "b": [] with "b": { "type": "string" }.

  • You can't index autoEmbed type fields and vector type fields in the same vectorSearch type index definition for MongoDB Vector Search $vectorSearch queries.

    You can index autoEmbed type fields and vector type fields in the same MongoDB Search index definition. For example, the following fields mapping indexes the plot_embedding_voyage_4_large field as the vector type and the plot field as the autoEmbed type:

    { "plot_embedding_voyage_4_large": { "type": "vector", "numDimensions": 1024, "similarity": "cosine" }, "plot": { "type": "autoEmbed", "model": "voyage-4", "modality": "text" }}