向量数据库 milvus 服务
host
: IP 地址/域名, 默认 127.0.0.1port
: 端口, 默认 19530username
: 用户名password
: 密码
创建集合
向集合插入数据
创建索引
将集合载入内存
向量搜索
健康检查
export const inject = ["milvus"];
// 定义 Schema
const collection_name = `hello_milvus`;
const schema = [
{
name: "age",
description: "ID field",
data_type: DataType.Int64,
is_primary_key: true,
autoID: true,
},
{
name: "vector",
description: "Vector field",
data_type: DataType.FloatVector,
dim: 8,
},
{ name: "height", description: "int64 field", data_type: DataType.Int64 },
{
name: "name",
description: "VarChar field",
data_type: DataType.VarChar,
max_length: 128,
},
];
// 创建集合
await ctx.milvus.createCollection({
collection_name,
fields: schema,
});