NewIvfSQ8Index()
This function creates an IVF_SQ8 index configuration that uses 8-bit scalar quantization to reduce memory usage.
func NewIvfSQ8Index(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.NewIvfSQ8Index(index.COSINE, 128)
// Use with CreateIndex
createIdxOption := milvusclient.NewCreateIndexOption("collection_name", "vector_field", idx)
task, err := client.CreateIndex(ctx, createIdxOption)