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.
autoEmbed 유형에 대한 인덱스 정의
autoEmbed 필드 속성 구성
옵션 | 유형 | 필요성 | 설명 |
|---|---|---|---|
| 문자열 | 필수 사항 | 이 토크나이저 유형을 식별하는 사람이 읽을 수 있는 레이블입니다. 값은 |
| 문자열 | 필수 사항 | Type of data in the source field. Value must be |
| 문자열 | 필수 사항 | 임베딩 생성에 사용할 Voyage AI 임베딩 모델입니다. 다음 모델 중 하나를 지정할 수 있습니다.
To learn more, see Automated Embedding Models. |
| Int | 옵션 | Number of vector dimensions that MongoDB Search enforces at index-time and query-time. You can specify one of the following values:
생략하면 기본값은 |
| 문자열 | 옵션 | 상위 K-최근접 이웃을 검색하는 데 사용하는 벡터 유사성 함수입니다. 다음 값 중 하나를 지정할 수 있습니다.
If omitted, the default depends on the
자세한 학습 은 유사성 함수 정보를 참조하세요. |
| 문자열 | 옵션 | 임베딩을 저장 데 사용할 데이터 유형입니다. 다음 값 중 하나를 지정할 수 있습니다.
생략하면 기본값은 |
| 문자열 | 옵션 | 벡터 필드 의 인덱스 구조입니다. 값은 다음과 같습니다.
생략하면 기본값은 |
| 객체 | 옵션 | Parameters to use for Hierarchical Navigable Small Worlds graph construction. This is mutually exclusive with the NOTE: We recommend using the default values. Specify 자세한 학습은 인덱싱 메서드 정보를 참조하세요. |
| Int | 옵션 | Hierarchical Navigable Small Worlds 그래프에서 노드가 가질 수 있는 최대 간선(또는 연결) 수입니다. 값은 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. |
| Int | 옵션 | 쿼리 시 숫자가 높을수록 고품질 연결을 가진 그래프가 제공되어 검색 품질(재현율)을 향상시킬 수 있지만, 쿼리 지연 시간에 부정적인 영향을 미칠 수도 있습니다. |
참고
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.
autoEmbed 유형에 대한 예시 사용해 보기
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.
autoEmbed 유형 제한 사항
다음과 같은 제한 사항이 적용됩니다:
You can't use a field name that begins with
_autoEmbedat 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
autoEmbedtype. This applies when you create or update the index. Use static mappings instead.You can't use the
autoEmbedtype in atypeSetdefinition. To learn which types a type set accepts, see Configure atypeSet.You can't use storedSource in index definitions that contain the
autoEmbedtype.You can't index fields inside an embeddedDocuments type field as the
autoEmbedtype. You can index fields inside a document type field as theautoEmbedtype.You can't specify a
pathoption in anautoEmbedtype field definition. The field name in the index mappings identifies the source field. For example, MongoDB Search rejects the followingfieldsmapping:{ "title": { "type": "autoEmbed", "path": "title", "model": "voyage-4", "modality": "text" }}You can't declare the same source path for more than one
autoEmbedtype field. This includes a literal dotted field name, such asparent.child, and the same path nested inside adocumenttype field. For example, MongoDB Search rejects the followingfieldsmapping:{ "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.childfield and keep only the nesteddocumenttype definition:{ "parent": { "type": "document", "dynamic": false, "fields": { "child": { "type": "autoEmbed", "model": "voyage-4", "modality": "text" } } }}You can't remove all
autoEmbedtype fields from an index.You can't index a source field as the
autoEmbedtype and as the document, embeddedDocuments, or geo type at the same path. You can index a source field as theautoEmbedtype and as a scalar type, such asstringortoken, at the same path. For example, the followingfieldsmapping indexes theplotfield as both thetokentype and theautoEmbedtype:{ "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
autoEmbedtype.You can't create an index for the
autoEmbedtype from the Atlas UI Visual Editor. Instead, use the JSON Editor.If your index definition contains an
autoEmbedtype 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 followingfieldsmapping declares thebfield without a type:{ "a": { "type": "document", "dynamic": false, "fields": { "b": [], "c": { "type": "autoEmbed", "model": "voyage-4", "modality": "text" } } }}Because the
bfield declaration adds no type, the index that MongoDB Search builds for automated embedding doesn't recorda.b. As a result, anexistsquery ona.bmight not match a document such as{ "a": { "b": "x" } }. Without theautoEmbedtype field, the same query matches the document.To make
existsqueries match, declare a type for the field. For example, replace"b": []with"b": { "type": "string" }.You can't index
autoEmbedtype fields andvectortype fields in the same vectorSearch type index definition for MongoDB Vector Search$vectorSearchqueries.You can index
autoEmbedtype fields and vector type fields in the same MongoDB Search index definition. For example, the followingfieldsmapping indexes theplot_embedding_voyage_4_largefield as thevectortype and theplotfield as theautoEmbedtype:{ "plot_embedding_voyage_4_large": { "type": "vector", "numDimensions": 1024, "similarity": "cosine" }, "plot": { "type": "autoEmbed", "model": "voyage-4", "modality": "text" }}