Registry / database / milvus-lite

milvus-lite

JSON →
library3.2.1pypypi✓ verified 24d ago

Milvus Lite is a lightweight, embedded version of Milvus, a high-performance vector database, designed for rapid prototyping, local development, and edge devices. It provides core vector search functionalities and shares the same API as Milvus Standalone and Distributed deployments, ensuring a consistent development experience across various scales. Data is persisted locally in an SQLite file. The library is actively maintained as part of the `pymilvus` ecosystem, with the current version being 2.5.1.

pip install -U pymilvus[milvus-lite]
INSTALL
IMPORT
SIG · MILVUS-LITE
M
milvus-lite
databasepythonv3.2.1
Install
9.9s avg
Import
2380ms
Disk
425MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 11.55s
py 3.11
✓ —
✓ 9.7s
py 3.12
✓ —
✓ 9.25s
py 3.13
✓ —
✓ 9.5s
py 3.9
1/2 runs
✓ 9.7s
425MB installed
● package 425MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MilvusClient
from pymilvus import MilvusClient
Milvus Lite is accessed via the MilvusClient from the pymilvus library by specifying a local file URI.
default_server
from milvus import default_server
from milvus_lite import default_server
For explicit server control (e.g., setting base directory), default_server is imported from 'milvus', not 'milvus_lite'.

This quickstart demonstrates how to initialize Milvus Lite using `MilvusClient` with a local database file, define a collection schema, insert data (vectors and scalar fields), perform a vector similarity search, and query data. The `uri` parameter for `MilvusClient` points to a local file, which acts as the Milvus Lite database.

from pymilvus import MilvusClient, DataType import os # Ensure a clean slate for demonstration if os.path.exists("milvus_demo.db"): os.remove("milvus_demo.db") # 1. Set up a Milvus client with a local file for persistence client = MilvusClient(uri="./milvus_demo.db") # 2. Create schema schema = MilvusClient.create_schema( auto_id=False, enable_dynamic_field=True, ) schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True) schema.add_field(field_name="vector", datatype=DataType.FLOAT_VECTOR, dim=5) schema.add_field(field_name="text", datatype=DataType.VARCHAR, max_length=256) # 3. Create a collection collection_name = "demo_collection" client.create_collection( collection_name=collection_name, schema=schema, # You can specify an index here, Milvus Lite will optimize internally # index_params=MilvusClient.prepare_index_params(metric_type="L2") ) # 4. Insert data data = [ {"id": 1, "vector": [0.1, 0.2, 0.3, 0.4, 0.5], "text": "The quick brown fox"}, {"id": 2, "vector": [0.5, 0.4, 0.3, 0.2, 0.1], "text": "Jumps over the lazy dog"}, {"id": 3, "vector": [0.8, 0.7, 0.6, 0.5, 0.4], "text": "A fast animal"}, ] client.insert(collection_name=collection_name, data=data) client.flush(collection_name=collection_name) # 5. Search for similar vectors search_vectors = [[0.15, 0.25, 0.35, 0.45, 0.55]] res = client.search( collection_name=collection_name, data=search_vectors, limit=2, output_fields=["text"], ) print("Search Results:", res) # 6. Query data by ID query_res = client.query(collection_name=collection_name, filter="id in", output_fields=["text"]) print("Query Results:", query_res) # Clean up (optional for next run) client.drop_collection(collection_name=collection_name) client.close() # Important to close client to ensure data is written to disk print("Milvus Lite demo finished successfully!")
Debug
Known issues
gotchaMilvus Lite is designed for small-scale prototyping (typically less than a million vectors) or edge devices. It is not recommended for large-scale production deployments where Milvus Standalone, Distributed, or Zilliz Cloud should be used instead.
fix
Evaluate your scale requirements early. For larger datasets or production, plan to migrate to other Milvus deployments. Milvus Lite provides a command-line tool for data migration.
affects: All versions
breakingPrior to Milvus Lite version 2.4.11, only the FLAT index type was supported, regardless of any other index type specified during collection creation. For versions 2.4.11 and later, both FLAT and IVF_FLAT are supported, with automatic internal switching (FLAT for <100,000 vectors, IVF_FLAT for >=100,000 vectors).
fix
If precise control over index types or more advanced indexing is critical, ensure you are on version 2.4.11 or later for IVF_FLAT support. For full index flexibility, use a non-Lite Milvus deployment.
affects: < 2.4.11
gotchaMilvus Lite does not support advanced Milvus features such as partitions, users/roles/RBAC (Role-Based Access Control), or aliases. Attempting to use these features will result in errors or unexpected behavior.
fix
If your application requires partitions, user management, or aliases, you must use Milvus Standalone, Milvus Distributed, or Zilliz Cloud.
affects: All versions
gotchaWhile Milvus Lite uses the same Python client API (`pymilvus`) as other Milvus deployments, the `uri` parameter for `MilvusClient` differs. For Milvus Lite, it's a local file path (e.g., './milvus_demo.db'). For other deployments, it's a network endpoint (e.g., 'http://localhost:19530' or a Zilliz Cloud endpoint).
fix
Be mindful of the `uri` parameter when transitioning an application developed with Milvus Lite to a different Milvus deployment. The rest of the client-side code should largely remain compatible.
affects: All versions
Upgrade
Version history
3.2.1latest on PyPI · released Aug 25, 2026
Audit
Dependencies
PythonrequiredRequired programming language environment.
pymilvus[bulk_writer]optionalNeeded for command-line data dumping/migration functionality.
Agent activity
128 hits · last 30 days
node
120
OpenAI (training)
1
Resources
milvus-lite — pip install milvus-lite · libregistry