Skip to main content

Milvus pass-through

The /milvus route forwards Milvus vector API paths, such as /v2/vectordb/entities/search, to a Milvus server the gateway knows. The collectionName in the body must name a vector store index managed by the gateway. The gateway checks the virtual key, confirms the key may use that index, swaps the index name for the real collection name, signs in with the stored Milvus credentials and forwards the request. Callers never learn the Milvus token or the collection's real name.

A real-world scenario​

A knowledge team keeps product embeddings in a Milvus collection and several apps query it with Milvus's own search API. The team registers the Milvus store on the gateway and an index named support-kb that points at the real collection. The apps send collectionName: "support-kb" to /milvus/v2/vectordb/entities/search with virtual keys. Milvus credentials stay on the gateway, a key can be granted or refused the index, and the real collection can be swapped without touching any app.

Before you start​

The gateway needs the Milvus store registered and an index that maps a public name to the real collection.

vector_store_registry:
- vector_store_name: milvus-prod
spanway_params:
vector_store_id: milvus-prod
custom_llm_provider: milvus
api_base: os.environ/MILVUS_API_BASE
api_key: os.environ/MILVUS_TOKEN

Steps​

  1. Register the Milvus store. Open /ui/vector-stores, click + Add Vector Store, pick Milvus under Provider, fill in API Key, API Base and Embedding Model, and save. Or add the vector_store_registry entry above to the config file.

  2. Register the index with a proxy admin key. The Indexes tab of the Vector Stores page lists it afterwards.

    curl -X POST http://localhost:4000/v1/indexes \
    -H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
    -H "Content-Type: application/json" \
    -d '{"index_name": "support-kb", "spanway_params": {"vector_store_name": "milvus-prod", "vector_store_index": "product_embeddings_v3"}}'
  3. Issue a virtual key on /ui/api-keys with + Create New Key, then Create Key, and grant it the milvus-prod store under its vector store permissions.

  4. Search through the gateway with the public index name as the collection.

    curl -X POST http://localhost:4000/milvus/v2/vectordb/entities/search \
    -H "Authorization: Bearer $SPANWAY_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"collectionName": "support-kb", "data": [[0.12, 0.98, 0.33]], "limit": 3, "outputFields": ["title"]}'
  5. Open /ui/logs and click the newest row to see the request and the key that made it.

Expected result​

Milvus's own response, with its status code and headers. The gateway rewrote collectionName to product_embeddings_v3 before forwarding.

{"code": 0, "data": [{"id": 4411, "distance": 0.91, "title": "Duplicate charge refunds"}]}

The spend log row carries the key, team and user.

Errors​

StatusMessageWhat it means and how to fix it
401Authentication Error, Invalid proxy server token passedThe virtual key is missing, wrong, expired or blocked.
403Key/team denied access to passthrough route /milvus/...The key or team lists the route in denied_passthrough_routes. The message goes on with Matched <pattern> in denied_passthrough_routes, naming the pattern to remove from the key or team.
400Collection name is required.The body has no collectionName.
400collectionName must be a string.collectionName is not a string.
400Collection support-kb is not a spanway managed vector store index. Only spanway managed vector store indexes are supported.No index with that name is registered. Register it with POST /v1/indexes.
403A message saying the key cannot access the vector storeThe key is not granted the store behind the index. Grant it under the key's vector store permissions.
500Unable to find Milvus vector store index registry or vector store registry. or api_base not found in vector store configuration ...The store or index registry is not loaded, or the store has no api_base. Check the registry entry.
Any otherMilvus's own error bodyMilvus refused the request. The message is returned unchanged.

Pass-through endpoints lists every built-in route. Create and register vector stores and vector store search cover the unified vector store API, and the Vector Stores page describes the Indexes tab.