NewBinIvfFlatIndex()
This function creates a BIN_IVF_FLAT index configuration for binary vector search with inverted file indexing.
func NewBinIvfFlatIndex(metricType MetricType, nlist int) Index
PARAMETERS:
metricType (MetricType)
The distance metric type for similarity search (e.g., index.COSINE, index.L2, index.IP).
nlist (int)
The number of cluster units (inverted lists). Higher values speed up search but reduce recall. Typical range: 1-65536.
RETURNS:
Index
An index configuration instance. Pass this to CreateIndex() via the index option.
Example
import (
"github.com/milvus-io/milvus/client/v2/index"
"github.com/milvus-io/milvus/client/v2/milvusclient"
)
// Create index configuration
idx := index.NewBinIvfFlatIndex(index.COSINE, 128)
// Use with CreateIndex
createIdxOption := milvusclient.NewCreateIndexOption("collection_name", "vector_field", idx)
task, err := client.CreateIndex(ctx, createIdxOption)