删除索引

最近更新时间:2025-04-18 17:58:12

我的收藏

接口定义

DropIndex()接口用于在已有集合上,删除标量字段索引。
DropIndex(ctx context.Context, databaseName string, collectionName string, params tcvectordb.DropIndexParams) (err error)
注意:
仅支持删除标量索引,不支持删除向量、稀疏向量索引。
如果集合开启了动态 schema(即创建集合时配置了 filterIndexConfig 参数),不支持删除标量索引。

使用示例

var (
ctx = context.Background()
database = "db-test"
collectionName = "go-sdk-test"
)
err := cli.DropIndex(ctx, database, collectionName, tcvectordb.DropIndexParams{
FieldNames: []string{"bookInfo", "page"},
})
printErr(err)

求参数

参数
是否必选
参数含义
配置方法及要求
databaseName
配置需删除索引的 Database 名称。
获取集群中的数据库列表,复制需重建索引的集合所属的数据库名。
collectionName
指定需删除索引的 Collection 名称。
获取指定数据库名下的 Collection 列表,复制需重建索引的集合名。
FieldNames
用于指定删除的标量索引的字段名。
以数组形式,列出需删除的字段名。