Recipes
These are the showcase of the VBase docs: runnable, end-to-end workflows using the standard Milvus SDK against a database VBase allocated for you. VBase is Milvus-SDK-compatible and runs Milvus 2.6, so everything you do with collections, indexes, and search here is plain Milvus β the same code you would write against any Milvus 2.6 cluster.
Each recipe is a single Python file you can paste, edit, and run.
What these recipes assume
You already have two things:
- An allocated database. Create one with
dodil vbase db create <name>(or the Databases API) and wait until its status isRUNNING. See the Quickstart. - An IAM access token. Your Dodil IAM service-account bearer token is your Milvus token β VBase manages the underlying Milvus users and RBAC for you, so you never run Milvus user or role commands.
Then you connect the Milvus SDK with three values from GetServiceAccess (or dodil vbase db use) β the endpoint, port, and db_name β plus your token. The pattern is the same in every recipe:
from pymilvus import MilvusClient
client = MilvusClient(
uri="https://<endpoint>:443", # endpoint + port from GetServiceAccess / `dodil vbase db use`
token="<IAM access token>", # your IAM service-account token IS your Milvus token
db_name="<db_name>", # the allocated database
)For how to obtain those values and the full connection details, see Connecting with the Milvus SDK and Auth and Access.
pip install "pymilvus>=2.6,<2.7"The recipes
- Semantic Search β the βHello, VBaseβ recipe. Create a collection with a schema (id, dense vector, text + metadata), build an HNSW / COSINE index, insert and upsert embeddings, then run a vector search with a metadata filter and read the results.
- Hybrid Search (Dense + BM25) β Milvus 2.6 hybrid search: combine a dense vector field with a BM25 sparse field, issue one
AnnSearchRequestper field, and fuse the results with an RRF or weighted reranker. A flagship Milvus 2.6 capability. - Bulk Ingest & Index β efficient batched insert of many vectors, how to choose an index and metric (HNSW vs IVF_FLAT vs IVF_SQ8; L2 vs IP vs COSINE), loading the collection, and organizing data with partitions.
- Migrate or Connect Existing β point an existing Milvus client or app at a VBase database by changing only
uri,token, anddb_name, and when to use VBase directly versus through K3 Vector.
How VBase fits in
VBase is the control plane: it allocates the database, hands you connection coordinates, authenticates you with IAM, and meters usage against your organizationβs quota. The data plane is Milvus itself β so for the full SDK and API surface (every index type, search parameter, and data-type option) the authoritative reference is the official Milvus documentationΒ . These recipes show the workflows; milvus.io has the exhaustive detail.
A note on metering that applies to every recipe:
- Searches and queries are metered as VectorRead.
- Inserts and upserts are metered as VectorWrite, and stored vectors count toward VectorStorage.
Everything else β provisioning, scaling, Milvus users, and RBAC β is managed for you.
See also
- Connecting with the Milvus SDK β get your
endpoint,port, anddb_name, and connect. - Auth and Access β how the IAM token authenticates the data plane.
- Databases API β allocate a database and resolve its access.
- Quickstart β allocate, connect, and run your first search end to end.
- Milvus documentationΒ β the full SDK and API reference.