Connect Milvus
Milvus is an external vector DB used for large-scale vector search. Use it when your organization already operates Milvus, or when the search data is very large and you want to manage it as a separate cluster.
Even when you use Milvus, the source files and the document text remain in SpaceBuilder. Only the vectors required for search and the minimum information are stored in Milvus.
Before you begin
- Required permission: Workspace administrator, and permission to manage Milvus collections
- The SpaceBuilder server must be able to reach the Milvus endpoint.
- Check the output dimension of the embedding model you will use.
Install Milvus
SpaceBuilder uses the REST API (v2, default port 19530) of Milvus 2.4 or later. It sends all requests to the /v2/vectordb/... path, so it does not work with Milvus 2.3 or earlier. You need a Milvus that the SpaceBuilder server can reach on this port. If you already operate Milvus, skip this section and go to Create the collection in advance.
Milvus has two deployment types: Standalone for a single server and Distributed for a large-scale cluster. Standalone is sufficient for connecting SpaceBuilder.
Preparation
| Item | Details |
|---|---|
| Server | Docker must be installed on a Linux server. Milvus is heavier than Qdrant, so placing it on a server other than the SpaceBuilder server is recommended. |
| Memory | At least 8 GB. If there are more than 1,000,000 vectors, 16 GB or more is recommended. |
| Disk | Data and logs are stored together, so allow plenty of space. An SSD is recommended. |
| Ports | 19530 (API). SpaceBuilder uses only this port. 9091 is for health checks and the management screen. |
Run
If you use the installation script provided by Milvus, it runs as a single container that includes the required components.
mkdir -p ~/milvus && cd ~/milvus
curl -sfL https://raw.githubusercontent.com/milvus-io/milvus/master/scripts/standalone_embed.sh -o standalone_embed.sh
bash standalone_embed.sh start
- The data is stored in
volumes/milvusunder the folder where you ran the script. If you delete this folder, the data is lost. - To stop or restart, run
bash standalone_embed.sh stop/bash standalone_embed.sh startin the same folder. - To change the settings, edit the
user.yamlcreated in the same folder and restart.
Enable authentication
If you operate it on a server other than the SpaceBuilder server, or on a network that many people can access, enable authentication. Add the following to user.yaml and restart.
common:
security:
authorizationEnabled: true
When authentication is enabled, you can connect with the default account root and the password Milvus. Always change the default password, and creating a separate account dedicated to SpaceBuilder is recommended. In the SpaceBuilder connection settings, you can enter an API key (a token in the username:password format) or a username and password. If you enter both, the API key is used.
Verify the installation
curl http://localhost:9091/healthz
If OK is returned, the installation is normal. Open http://<Milvus server address>:9091/webui/ in a browser to see the management screen, where you can view the collections and the status (Milvus 2.5 or later).
Operation tips
- Firewall: Restrict access so that only the SpaceBuilder server can connect to port
19530. Do not open9091to the outside. - Backup: Vectors are derived data that can be created again from the source. Even without a separate backup, you can refill the vector DB with
Sync Existing Embeddingsin SpaceBuilder. - Update: When you raise the Milvus version, follow the official Milvus upgrade guide. If the minor version changes, a data migration may be required.
Create the collection in advance
Unlike Qdrant, a Milvus collection is not created automatically. Before you save the connection settings, you must first create the collection with the structure below.
| Field | Type | Description |
|---|---|---|
id | VARCHAR(64), primary key | Vector ID |
instance_namespace | VARCHAR(64) | The instance isolation key. The value differs for each instance (one SpaceBuilder that is installed and operated separately). |
generation_id | VARCHAR(64) | Indexing generation |
chunk_id | INT64 | Document piece number |
space_flag | VARCHAR(16) | Team space (team) or personal space (client) |
owner_id | VARCHAR(64) | Owner |
source_path | VARCHAR | Source file path |
text | VARCHAR | The document piece shown in search results |
vector | FLOAT_VECTOR | The embedding vector. The dimension must be the same as the embedding model. |
- The dimension (
dim) of thevectorfield must be the same as the vector dimension you will set in SpaceBuilder. (1024forbge-m3) - The index distance metric of the
vectorfield must beCOSINE. - SpaceBuilder truncates
textat 4,096 characters before storing it. In UTF-8, a Korean character takes 3 bytes and an emoji takes 4 bytes, so if you setmax_lengthto16384(4,096 characters × 4 bytes) or more, no document piece reaches the length limit. - For
source_path, file paths can be long and can contain Korean characters, so allow plenty of length, about4096.
The following command creates the collection with the Milvus REST API (v2). Change <Milvus server address>, the authentication information, the collection name, and the dim value to match your environment.
- In
Authorization, enter<username>:<password>, or enter an API key (token) in its place. - If authentication is not enabled, delete the
Authorizationline.
curl -X POST "http://<Milvus server address>: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" } }
]
}'
If a response that contains "code":0 is returned, the collection has been created.
Connection settings
In Vector DB Setup on the Knowledge Storage screen, enter the values below and save.
| Item | Value to enter | Description |
|---|---|---|
| Driver | Milvus | Uses an external Milvus server. |
| Endpoint | http://<Milvus server address>:19530 | If you omit http://, it is added automatically. If left empty, http://localhost:19530 is used. |
| Collection | The name of the collection you created in advance | A different name for each instance is recommended. The screen shows the recommended name for this instance (setfn_knowledge_...). |
| API key | Milvus token | Enter it only when you connect with a token to a Milvus that has authentication enabled. The stored value is shown masked and is kept unless you change it. If you save with the field empty, it is deleted. |
| Username / Password | Milvus account | Enter them when you use account authentication. Enter the password only when you change it; if left empty, the stored value is kept. |
| Vector dimensions | The same value as the dim of the collection | If it differs, the connection succeeds but indexing fails at the storage step. |
Milvus is a service-backed store, so the Data Path field is not shown. When you save, the indexing scheduler checks the new settings and, if needed, automatically starts a full reindexing from the source.
Check the connection
Check the status in Vector DB Overview.
| Item | When normal |
|---|---|
| Connection | Connected |
| Collection configuration | OK (compatible with current settings) |
| Stored vectors | Increases as indexing proceeds. Only the vectors stored by this instance are counted. |
| Total Collections | The total number of collections on the Milvus server. |
If the status is not normal, check the following.
| Display | Cause and action |
|---|---|
Collection not found · create it in Milvus first | The collection has not been created yet, or the name is different. Create the collection with the structure above or correct the name. |
Collection configuration needs review + collection dimension is ..., expected ... | The collection dimension differs from the vector dimension you set. Create a new collection with the correct dimension and specify it. |
Collection configuration needs review + collection metric must be COSINE | The metric of the vector index is not COSINE. Create the index again with COSINE. |