Skip to main content
Milvus is a cloud-native vector database designed for billion-scale vector search. It supports both Zilliz Cloud (managed) and self-hosted deployments with advanced features like partition-key multi-tenancy and JSON path filtering.

Key features

  • Partition-key isolation: Physical data separation for millions of tenants
  • Hybrid search: RRF or weighted fusion of dense and sparse vectors
  • JSON path indexing: Efficient filtering on nested metadata
  • HNSW indexing: Fast approximate nearest neighbor search
  • Zilliz Cloud: Fully managed service with auto-scaling
  • Self-hosted: Open-source deployment with Docker or Kubernetes

Installation

Connection

Zilliz Cloud

Self-hosted Milvus

Legacy host/port format

Collection creation

Basic collection

With partition keys for multi-tenancy

Recreate existing collection

JSON path indexing

Create indexes on nested metadata fields for fast filtering:
Supported cast types:
  • VARCHAR: String values
  • DOUBLE: Numeric values
  • BOOL: Boolean values

Inserting documents

From Haystack documents

With sparse embeddings

Searching

Hybrid search with RRF

Reciprocal Rank Fusion (default, parameter-free):

Hybrid search with weighted ranker

Explicit control over dense vs. sparse balance:

Metadata filtering

Supported filter operators

  • $eq: Equal to
  • $gt: Greater than
  • $lt: Less than
  • $in: Value in list
  • $contains: JSON array contains value

Metadata-only query

Multi-tenancy with partition keys

Setup partition-based isolation

Partition keys provide physical data isolation at the storage layer, making multi-tenant queries significantly faster than post-filtering. Milvus supports millions of tenants efficiently.

Deleting documents

Delete by IDs

Delete by filter

Delete namespace

Building filter expressions

Dropping collections

This permanently deletes all data in the collection. Cannot be undone.

Advanced configuration

HNSW index parameters

Milvus creates HNSW indexes automatically with these defaults:
To customize, modify src/vectordb/databases/milvus.py:253.

Sparse index configuration

Sparse vectors use SPARSE_INVERTED_INDEX with inner product metric:

Best practices

Use partition keys when serving thousands to millions of tenants:
Create indexes on frequently filtered fields:
  • RRF: Best for most use cases, no tuning needed
  • Weighted: When you know the optimal dense/sparse balance
Milvus loads collections into memory for fast search:
  • Monitor memory usage with large collections
  • Use drop_collection() to free memory
  • Consider Qdrant with quantization for memory-constrained environments

Error handling

Source reference

Implementation: src/vectordb/databases/milvus.py Key classes and methods:
  • MilvusVectorDB.__init__(): src/vectordb/databases/milvus.py:103
  • create_collection(): src/vectordb/databases/milvus.py:150
  • create_json_index(): src/vectordb/databases/milvus.py:272
  • insert_documents(): src/vectordb/databases/milvus.py:332
  • search(): src/vectordb/databases/milvus.py:398
  • delete_documents(): src/vectordb/databases/milvus.py:742