跳到主要内容

NewInvertedIndex()

此函数会创建一个倒排索引配置,用于对标量字段进行高效过滤。

go
func NewInvertedIndex() Index

返回:

Index

一个索引配置实例。可通过 index 选项将其传递给 CreateIndex()

示例

go
import (
"github.com/milvus-io/milvus/client/v2/index"
"github.com/milvus-io/milvus/client/v2/milvusclient"
)

// Create index configuration
idx := index.NewInvertedIndex()

// Use with CreateIndex
createIdxOption := milvusclient.NewCreateIndexOption("collection_name", "vector_field", idx)
task, err := client.CreateIndex(ctx, createIdxOption)
最低 SDK 版本v2.6.x