Milvus in Production: Architecture, Indexes, Hybrid Search, and Scaling
Milvus is an open-source vector database built for similarity search over large embedding collections. It is useful when an application needs to retrieve items by semantic similarity rather than exact keys: documents for RAG, product recommendations, image search, multimodal retrieval, duplicate detection, agent memory, or any workload where vectors are part of the query path.
The interesting question is not whether Milvus can store embeddings. Many systems can do that.
The real question is when Milvus is the right retrieval layer, how its architecture works, and what choices actually matter in production.
This guide focuses on those decisions.
What Milvus Actually Does
A typical vector-search request looks like this:
User query
↓
Embedding model
↓
Query vector
↓
Milvus ANN search
↓
Optional scalar filters / reranking
↓
Top matching records
Milvus stores vector fields alongside scalar metadata. A collection schema can include a primary key, one or more vector fields, and scalar fields such as tenant ID, document type, timestamps, category, language, or permissions.
That matters because most real applications do not want “the nearest 20 vectors in the entire database.” They want something closer to:
nearest documents
WHERE tenant_id = 42
AND language = 'en'
AND visibility = 'public'
Vector retrieval and metadata filtering therefore need to be designed together.
Search Modes You Should Know
Milvus supports more than a basic nearest-neighbor lookup.
ANN search
Approximate nearest-neighbor search retrieves the top K vectors closest to a query vector according to the configured metric and index.
This is the standard retrieval primitive for semantic search and RAG.
Filtered search
ANN search can be combined with scalar filtering. This is essential for multi-tenant systems, access control, language filtering, product catalogs, and time-bounded search.
Range search
Instead of asking only for the top K, range search retrieves vectors that fall inside a similarity or distance boundary.
This is useful when a fixed result count would be misleading—for example, duplicate detection where you only want results above a similarity threshold.
Hybrid search
Milvus supports hybrid retrieval across multiple vector fields and can combine signals before reranking.
A document system might store separate vectors for:
title_embedding
body_embedding
image_embedding
and combine those signals according to the application’s retrieval strategy.
Full-text search and reranking
Current Milvus documentation also exposes full-text search based on BM25 plus reranking capabilities. That makes it possible to build retrieval pipelines that combine lexical and semantic signals instead of treating vector search as the only ranking signal.
For many RAG systems, this is a stronger default than pure dense-vector retrieval.
Milvus Architecture: Why It Scales Differently
Milvus uses a cloud-native architecture that separates storage and compute.
At a high level:
Clients / SDKs
↓
Access layer / Proxy
↓
Coordinator
↓
Worker nodes
↓
Shared storage + WAL
The important architectural idea is disaggregation.
Search, ingestion, coordination, and durable storage do not have to scale as one monolithic process. Compute capacity can be changed independently from the underlying stored dataset.
Milvus documentation describes four major architectural layers:
- access layer
- coordinator service
- worker nodes
- storage
The access layer is made of stateless proxies that accept client requests and aggregate results. The coordinator manages cluster topology and scheduling. Worker nodes perform data and query work. Durable data lives in shared storage.
This design becomes useful when vector retrieval is no longer a small feature inside a single backend process and instead becomes a dedicated data-serving workload.
Schema Design Still Matters in a Vector Database
A common mistake is treating vector databases as schemaless embedding buckets.
Milvus collections have schemas, and good schema design directly affects how easy it is to filter, partition, secure, and operate the data.
Imagine a RAG collection:
id
tenant_id
document_id
chunk_id
text
embedding
source_type
language
created_at
The vector is only one part of the record.
Before creating a collection, decide:
- which field is the primary key
- which vector dimensions and data types are required
- which metadata fields must be filterable
- whether multiple vector fields are necessary
- how tenant isolation will be enforced
- which fields need scalar indexes
- whether partition keys can improve pruning
Do not move every attribute into JSON simply because flexible metadata is convenient. Frequently filtered fields deserve deliberate schema design.
Choosing an Index: Optimize for the Workload
Vector indexes trade memory, build time, latency, throughput, and recall.
Milvus supports multiple indexing approaches, including families such as HNSW, IVF-based indexes, and disk-oriented search options. The best choice depends on the dataset and serving constraints.
HNSW-style indexes
A strong choice when low-latency, high-recall search is important and sufficient memory is available.
The cost is typically higher memory usage and more expensive index construction than simpler alternatives.
IVF-style indexes
Useful when you want tunable search cost through clustering and probing. Search can inspect a subset of partitions rather than the entire vector space.
Tuning the number of probed lists changes the latency/recall trade-off.
Disk-oriented indexes
Useful when datasets are too large or too expensive to keep fully memory-resident.
The key lesson is simple:
> Do not choose a vector index because it is popular. Benchmark your own embeddings, filters, result counts, concurrency, and recall requirements.
Synthetic vector benchmarks rarely model your real metadata filters or query distribution.
Pick the Right Similarity Metric
Your embedding model and vector normalization strategy determine which distance metric makes sense.
Common choices include:
- cosine similarity
- inner product
- Euclidean/L2 distance
Do not independently choose the metric after embeddings are already in production. Follow the embedding model’s guidance and verify retrieval quality on a representative evaluation set.
A fast index with the wrong similarity semantics is still a bad retrieval system.
Consistency Is a Product Decision, Not Just a Database Setting
Distributed retrieval systems have to balance freshness, latency, and availability.
Milvus exposes four consistency levels:
- Strong — reads wait for the latest visible data.
- Bounded staleness — permits controlled staleness and is the default documented mode.
- Session — writes performed by a client become visible to reads in that session.
- Eventual — prioritizes lower latency while replicas converge over time.
Choose based on product behavior.
For example, after a user uploads a document and immediately asks a question about it, stale retrieval may be confusing. Session or stronger guarantees may be appropriate.
For a recommendation system ingesting continuous behavioral signals, a small amount of staleness may be perfectly acceptable.
Consistency should therefore be chosen per workload rather than globally treated as “stronger is always better.”
Multi-Tenant Retrieval Needs Explicit Isolation
A SaaS application must never rely on semantic similarity alone to isolate customers.
Every query should carry an authenticated tenant boundary, typically through a scalar field and filter:
tenant_id == authenticated_tenant
For sufficiently large tenant populations, partition-key design may also help reduce the amount of data considered during retrieval.
But the security rule is more important than the performance rule:
> Tenant filtering must be enforced by trusted backend code, not supplied freely by the client.
Vector databases can leak highly sensitive information if authorization is treated as an afterthought.
Hybrid Retrieval Is Often Better Than “Vector Search Everywhere”
Dense embeddings are excellent at semantic similarity, but they can miss exact identifiers, rare names, codes, error messages, SKUs, legal clauses, and domain-specific vocabulary.
A production retrieval pipeline can combine:
Dense semantic retrieval
+
Lexical/BM25 retrieval
+
Metadata filtering
+
Reranking
For RAG, evaluate the quality of the retrieved context—not only vector latency.
Useful retrieval metrics include:
- recall@K
- precision@K
- mean reciprocal rank
- nDCG
- answer-grounding or task-specific success
The vector database is only one component of retrieval quality.
Ingestion and Indexing Are Separate Operational Concerns
Production systems continuously insert, update, and delete records while search remains available.
Plan for:
- ingestion throughput
- index build cost
- compaction
- deletion behavior
- schema evolution
- backfills
- re-embedding when models change
Embedding-model migrations deserve special attention.
Changing from one embedding model to another often changes vector dimensions or the geometry of the embedding space. Mixing incompatible embeddings inside the same search field produces meaningless similarity comparisons.
A safer migration pattern is:
old_embedding field / collection
↓
background re-embedding
↓
new index built and evaluated
↓
traffic migration
↓
old representation retired
Treat embedding changes like database migrations.
What to Monitor
A vector database should be operated like any other critical production service.
Monitor at least:
- query latency percentiles
- search throughput
- ingestion throughput
- error rate
- CPU and memory pressure
- storage growth
- index build duration
- compaction/backlog behavior
- node health
- replica health
- result-quality regressions after index or embedding changes
The last item is easy to miss.
A vector system can be technically healthy while retrieval quality silently becomes worse.
Operational metrics and relevance evaluations need to exist together.
When Milvus Is a Good Fit
Milvus becomes attractive when you need several of these at once:
- large vector collections
- dedicated similarity-search infrastructure
- high query throughput
- advanced index choices
- scalar filtering
- hybrid or multi-vector retrieval
- horizontal scaling
- independent compute/storage scaling
- self-hosted or cloud-native deployment options
It is especially compelling when vector retrieval is a core subsystem rather than a small supporting feature.
When Milvus May Be Too Much
A specialized vector database is not mandatory for every RAG application.
If your application has a modest dataset, low query volume, and already depends on a relational database with adequate vector-search support, introducing a separate distributed database may add more operational complexity than value.
Before adding Milvus, ask:
- Is vector retrieval actually a scaling bottleneck?
- Do we need index/search capabilities our current database cannot provide well?
- Do we need independent scaling for retrieval?
- Can our team operate another stateful distributed system?
- Have we measured retrieval quality, not just benchmark latency?
If the answer to most of these is no, starting simpler can be the better engineering decision.
A Practical Production Checklist
- Embedding model and similarity metric are compatible
- Collection schema reflects real metadata filters
- Tenant and authorization filters are enforced server-side
- Index choice is benchmarked with representative traffic
- Recall/quality is evaluated, not assumed
- Consistency level matches product freshness requirements
- Re-embedding migrations are planned
- Query latency and ingestion health are monitored
- Backup and recovery procedures are defined for the deployment model
- Hybrid retrieval is evaluated where lexical matching matters
Final Takeaway
Milvus is not valuable simply because it stores vectors. Its real advantage appears when vector retrieval becomes an infrastructure problem: large datasets, high concurrency, hybrid search, independent scaling, multiple consistency needs, and production operations around continuously changing embeddings.
Start with the retrieval requirements, not the technology.
If a simple database-backed vector index meets those requirements, keep the architecture simple. If retrieval has become a dedicated high-scale workload, Milvus gives you a purpose-built system with the architecture and search primitives to treat it that way.
Official References
BUILDING AN AI PRODUCT?
Talk to Lofingo about custom autonomous AI agents, enterprise workflow automation, and scalable software systems.
EXPLORE AI SERVICES →