Connect Milvus

Milvus is an external vector database suited to organizations that already operate Milvus or need a separately managed cluster. Source files remain in SpaceBuilder; Milvus stores vectors and the minimum payload required for retrieval.


Before you begin

  • Required role: Workspace administrator and permission to create a Milvus collection
  • The SpaceBuilder server must reach the Milvus endpoint.
  • Confirm the output dimension of the embedding model.
  • SetFN uses the Milvus REST v2 API on port 19530, so use a compatible Milvus release.

Prepare Milvus

Milvus provides an official Docker Compose installation for standalone deployments. The standard configuration exposes Milvus on 19530 and its WebUI on 9091.

After starting the service, verify health:

curl http://localhost:9091/healthz

Open http://<milvus-host>:9091/webui/ to inspect service and collection state on supported versions. Restrict ports 19530 and 9091 to trusted networks.

When authentication is enabled, configure a dedicated credential for SetFN. Milvus tokens use the username:password form. If both a token and username/password are entered in SetFN, the token is used.

Create the collection first

Unlike the Qdrant integration, SetFN does not create a Milvus collection. Create it before saving the connection.

FieldType and requirement
idVARCHAR(64), primary key
instance_namespaceVARCHAR(64)
generation_idVARCHAR(64)
chunk_idINT64
space_flagVARCHAR(16)
owner_idVARCHAR(64)
source_pathVARCHAR, recommended max_length 4096
textVARCHAR, recommended max_length 16384
vectorFLOAT_VECTOR; dim must match the embedding model

The vector index must use the COSINE metric. AUTOINDEX is supported by Milvus, as described in the official collection guide. Disable dynamic fields for the SetFN collection.

The following example uses the REST v2 API. Replace the endpoint, token, collection name, and vector dimension.

curl -X POST "http://<milvus-host>:19530/v2/vectordb/collections/create" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <username>:<password>" \
  -d '{
    "collectionName": "setfn_knowledge_example",
    "schema": {
      "autoId": false,
      "enableDynamicField": false,
      "fields": [
        { "fieldName": "id", "dataType": "VarChar", "isPrimary": true, "elementTypeParams": { "max_length": 64 } },
        { "fieldName": "instance_namespace", "dataType": "VarChar", "elementTypeParams": { "max_length": 64 } },
        { "fieldName": "generation_id", "dataType": "VarChar", "elementTypeParams": { "max_length": 64 } },
        { "fieldName": "chunk_id", "dataType": "Int64" },
        { "fieldName": "space_flag", "dataType": "VarChar", "elementTypeParams": { "max_length": 16 } },
        { "fieldName": "owner_id", "dataType": "VarChar", "elementTypeParams": { "max_length": 64 } },
        { "fieldName": "source_path", "dataType": "VarChar", "elementTypeParams": { "max_length": 4096 } },
        { "fieldName": "text", "dataType": "VarChar", "elementTypeParams": { "max_length": 16384 } },
        { "fieldName": "vector", "dataType": "FloatVector", "elementTypeParams": { "dim": 1024 } }
      ]
    },
    "indexParams": [
      { "fieldName": "vector", "indexName": "vector", "metricType": "COSINE", "params": { "index_type": "AUTOINDEX" } }
    ]
  }'

Remove the Authorization header only when authentication is disabled.

Configure the SetFN connection

  1. Open Knowledge Services > Knowledge Storage.
  2. Select Milvus as the driver.
  3. Enter the endpoint, such as http://milvus.internal:19530.
  4. Enter the collection name and credentials.
  5. Set the vector dimension to the collection's dim.
  6. Select Save.

Saving a changed store queues a full reindex when required.

Verify the connection

StateMeaning and action
Connected; dimension and metric matchThe collection is ready.
Collection missingCreate the collection or correct its name.
Dimension mismatchCreate or select a collection whose dim matches the embedding model.
Metric must be COSINERecreate the vector index with COSINE.

The entity count increases as indexing writes vectors. It counts only data owned by this SpaceBuilder installation; collection count covers the entire Milvus service.