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

Configure mongot for MongoDB Vector Search Automated Embedding

중요

Automated Embedding is in Preview for self-managed mongot. The feature and corresponding documentation might change at any time during the Preview period. To learn more, see Preview Features.

This tutorial describes how to configure Automated Embedding on a self-managed mongot deployment. With Automated Embedding, mongot generates vector embeddings for your text data at index-time and for query text at query-time. You don't have to maintain a separate embedding pipeline in your application.

This tutorial is for developers who are building semantic search or RAG features and want mongot to manage embeddings.

Without Automated Embedding, your application must:

  1. Generate an embedding for each document that you insert or update.

  2. Store that embedding alongside the document in your collection.

  3. Generate an embedding for every query, using the same model, at query-time.

  4. Submit the query embedding to $vectorSearch.

With Automated Embedding, mongot handles steps 1, 2, and 3. Your application:

  1. Configures a MongoDB Vector Search index with the autoEmbed field type for the text field.

  2. Inserts and updates documents normally.

    mongot reads the text field, generates the embedding through the configured embedding model, and stores it.

  3. Issues $vectorSearch queries with the query text, not a pre-computed embedding.

    mongot generates the embedding for the query text.

Self-managed mongot Automated Embedding integrates with Voyage AI embedding models.

모델
설명

voyage-4

Recommended. Balanced performance for general text search.

voyage-4-lite

High-volume, cost-sensitive applications.

voyage-4-large

복잡한 시맨틱 관계에 대한 정확도를 극대화합니다.

voyage-code-3

코드 검색 및 기술 문서화에 전문화되어 있습니다.

You incur costs for embedding generation. To learn more, see Manage Billing for Automated Embedding.

You must have the following prerequisites to use Automated Embedding:

  • mongot 1.70.1 or later on a self-managed deployment (Community tarball or container, Local Development, and Enterprise Edition through Kubernetes Operator).

  • MongoDB 8.2 이상.

  • Two Voyage AI API keys.

    Use two separate keys, one for index-time embedding generation and one for query-time. Separate keys isolate query workload from indexing workload and allow independent rate-limit accounting. To learn more, see Rate Limits.

  • Outbound network access from mongot to the embedding endpoint.

    The default endpoint is https://ai.mongodb.com/v1/embeddings. This endpoint proxies Voyage AI with MongoDB-managed billing, for keys generated using the Atlas UI. You can also use https://api.voyageai.com/v1/embeddings for direct Voyage AI access if you generated the API key directly from Voyage AI.

1

You can generate Voyage AI API keys through either of the following methods:

  • (Recommended) Through your Atlas account. Atlas provides API key management with built-in rate-limit configuration. The keys are not tied to an Atlas cluster. To learn more, see Manage API Keys.

  • Through Voyage AI directly at voyageai.com.

Generate two keys and name them clearly, for example, mongot-prod-index and mongot-prod-query. Store the keys in secure secret storage.

2

The configuration depends on your deployment path. Select the tab for your deployment.

Automated Embedding requires the preview Local Development image (mongodb/mongodb-atlas-local:preview). The preview image bundles the Community build of mongot, which includes the Automated Embedding integration.

If you launch the container directly with docker run, pass the Voyage AI API key with the VOYAGE_API_KEY environment variable and use the :preview tag:

docker run \
-e VOYAGE_API_KEY=<your-voyage-api-key> \
-p 27017:27017 \
mongodb/mongodb-atlas-local:preview

If you issued your Voyage AI key directly through Voyage AI rather than through Atlas, override the default endpoint:

docker run \
-e VOYAGE_API_KEY=<your-voyage-api-key> \
-e EMBEDDING_PROVIDER_ENDPOINT=https://api.voyageai.com/v1/embeddings \
-p 27017:27017 \
mongodb/mongodb-atlas-local:preview

참고

Local Development accepts only a single Voyage AI API key and uses it for both index-time and query-time embedding generation. A single key is acceptable for development. For production deployments that need separate index-time and query-time keys, use the Community Edition or Kubernetes Operator deployment path.

Add the embedding block to your mongot configuration file:

embedding:
queryKeyFile: /etc/mongot/secrets/voyage-api-query-key
indexingKeyFile: /etc/mongot/secrets/voyage-api-indexing-key
providerEndpoint: https://ai.mongodb.com/v1/embeddings

Each key file contains the API key as its only content. Set the file permissions to 0600 and set the file owner to the user that runs the mongot process.

3

After you configure mongot with your Voyage AI API keys, define a MongoDB Vector Search index that uses the autoEmbed field type. The index definition specifies which text field mongot embeds and which model it uses. It also specifies the indexing method, quantization, and other parameters.

db.movies.createSearchIndex(
"movie-semantic-index",
"vectorSearch",
{
"fields": [
{
"type": "autoEmbed",
"modality": "text",
"path": "plot",
"model": "voyage-4",
"numDimensions": 1024,
"similarity": "cosine",
"indexingMethod": "hnsw",
"hnswOptions": {
"maxEdges": 16,
"numEdgeCandidates": 50
},
"quantization": "scalar"
},
{
"type": "filter",
"path": "genre"
}
]
}
)

The following table describes the autoEmbed index definition fields:

필드
목적

type: "autoEmbed"

Marks the field for automatic embedding.

modality: "text"

The data modality. text is the only supported modality.

path

The field in your collection to embed.

model

The Voyage AI model name. The model must be one that your API key has access to.

numDimensions

The number of dimensions for the embedding vector. The model determines the supported dimensions.

similarity

The similarity function to use for vector search. The supported functions are cosine, dotProduct, and euclidean.

indexingMethod

The indexing method to use. The supported methods are flat and hnsw.

hnswOptions

(Optional) The HNSW index options. Required if indexingMethod is hnsw.

quantization

(Optional) The quantization type to use. The supported types are float, scalar, binary, and binaryNoRescore.

You can mix autoEmbed fields with filter fields in the same index. You cannot mix autoEmbed with raw vector fields on the same path. Choose one approach per field.

4

Submit query text, not a pre-computed embedding. mongot generates the query embedding for you.

db.movies.aggregate([
{
"$vectorSearch": {
"index": "movie-semantic-index",
"path": "plot",
"query": "a heist gone wrong in a rainy city",
"model": "voyage-4",
"numCandidates": 100,
"limit": 10
}
},
{
"$project": {
"_id": 0,
"title": 1,
"score": { $meta: "vectorSearchScore" }
}
}
])

To learn more, see Run Vector Search Queries.

mongot persists embeddings in a dedicated internal database on the cluster. mongot does not store embeddings in your source collection. mongot can regenerate embeddings from the source text, and you incur charges for embedding generation.

Changes to the embedding model, output dimensions, or quantization trigger a full re-embedding of the affected index, for which you incur charges for embedding generation. See When mongot Regenerates Embeddings.

To learn more, see Generated Embeddings Collection.

mongot regenerates embeddings for an autoEmbed field when any of the following occur:

  • You insert a document.

  • You change the embedded field in a document. mongot detects the change through change streams.

  • You change the embedding model in the index definition.

  • You change the embedding output dimension or data type.

  • You change the text field path.

If you change any of the last three items, mongot rebuilds the entire index from scratch. The rebuild can be costly for large collections. Plan model changes deliberately.

MongoDB charges per million tokens at model-specific rates. Indexing cost is proportional to the total text volume of the indexed field across the collection. Query cost is proportional to the volume of query text.

If you use the Voyage AI API key that you created using your Atlas account, you can view API key usage and rate limits in the Atlas UI. To learn more, see Manage Billing for the Embedding and Reranking API. If you use keys created directly from Voyage AI, you must monitor your usage and rate limits in the Voyage AI dashboard.

Voyage AI-side rate-limit errors appear in mongot logs and as failed-document indicators on the affected index. These errors do not disable the index, but they can delay indexing of new documents.

증상
가능한 원인
작업

The index stays in PENDING status past a few minutes.

mongot cannot reach the embedding endpoint, or the API key is invalid.

Check mongot logs for HTTP errors against the embedding endpoint.

Indexing delays appear intermittently.

Voyage AI-side rate limiting.

Either increase your rate limit or reduce indexing-time embedding load.

Queries against the index return an error that mentions embeddings.

The query API key is invalid or expired.

Verify the contents of queryKeyFile.

All queries against the index return empty results.

The index might have been rebuilt and is still re-embedding the corpus.

Check the index status with db.collection.getSearchIndexes().

The following limitations apply to Automated Embedding:

  • Preview status. Configuration shape, supported models, and default endpoints might change before Automated Embedding is generally available.

  • One embedding model per field. Mixed-model indexes are not supported.

  • No embedding model failover. If the Voyage AI endpoint is unreachable, indexing of new documents stalls.