# How should embeddings from voyage-code-2 be stored?

Source: https://zilliz.com/ai-faq/how-should-embeddings-from-voyagecode2-be-stored
Author: zilliz

Embeddings from voyage-code-2 should be stored as vectors in a schema that preserves both **retrieval performance** and **debuggability**. Concretely, you want a record per retrievable unit (often a function/class/snippet), with fields like: a primary key (`id`), a vector field (`embedding`, dimension 1536), the original text (`content`), and metadata (`repo`, `path`, `language`, `symbol`, `commit`, `license`, `is_generated`, `owner_team`, `access_level`). voyage-code-2’s model guide lists its embedding dimension (1536), which you should match in your vector field definition so the database can validate inserts and build indexes correctly. 

The most practical storage target is a vector database such as [Milvus](https://milvus.io/) or [Zilliz Cloud](https://zilliz.com/cloud). Milvus supports Voyage embedding functions and model selection (including `voyage-code-2`), and it’s designed to index large vector collections efficiently. Storage best practices look like this: (1) store chunk-level embeddings (function-level is a strong default), (2) store enough metadata to filter aggressively, and (3) store “presentation fields” (like `path`, `symbol`, `start_line`, `end_line`) so you can show results and debug why a match happened. If you’re doing code + docs together, you can either use separate collections (one for code, one for docs) or a shared collection with a `type` field (`code`, `doc`, `issue`) to support unified search while still allowing filtered queries.

For long-term maintainability, treat embeddings as versioned artifacts. Re-embedding is normal when you change chunking or upgrade the model. Store `embedding_model="voyage-code-2"` and `embedding_version` so you can run migrations safely. Also store `commit` (or a content hash) so you can update only what changed. Finally, don’t skip access control: store an `acl_group` or `visibility` field and enforce it in every query filter so retrieved code matches the user’s permissions. With Milvus or Zilliz Cloud, you can combine similarity search with metadata filtering, which is the difference between “we can find similar code” and “we can run this in production without surprises.”

For more information, click here: <https://zilliz.com/ai-models/voyage-code-2>
