Indexes
The struct types on this page implement the method signatures of the entity.Index
interface.
entity.GenericIndex
This struct type applies to general purposes without any constraint on the index type. You can use entity.NewGenericIndex()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewGenericIndex(name string, it entity.IndexType, params map[string]string)
Parameter | Description | Type |
---|---|---|
| Name of the index. |
|
| Type of the index. |
|
| Index parameters corresponding to the specified index type. |
|
entity.IndexAUTOINDEX
This struct type creates an AUTOINDEX for the specified field. You can use entity.NewIndexAUTOINDEX()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexAUTOINDEX(metricType MetricType)
Parameter | Description | Type |
---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
|
entity.IndexBinFlat
This struct type creates a BIN_FLAT index for the specified field. You can use entity.NewIndexBinFlat()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexBinFlat(metricType MetricType, nlist int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of cluster units. |
|
|
entity.IndexBinIvfFlat
This struct type creates a BIN_IVF_FLAT index for the specified field. You can use entity.NewIndexBinIvfFlat()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexBinIvfFlat(metricType MetricType, nlist int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of cluster units. |
|
|
entity.IndexDISKANN
This struct type creates a DiskANN index for the specified field. You can use entity.NewIndexDISKANN()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexDISKANN(metricType MetricType)
Parameter | Description | Type |
---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
|
entity.IndexFlat
This struct type creates a FLAT index for the specified field. You can use entity.NewIndexIvfFlat()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexFlat(metricType MetricType)
Parameter | Description | Type |
---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
|
entity.IndexGPUBruteForce
This struct type creates a GPU_BRUTE_FORCE index for the specified field. You can use entity.NewIndexGPUBruteForce()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexGPUBruteForce(metricType MetricType)
Parameter | Description | Type |
---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
|
entity.IndexGPUCagra
This struct type creates a GPU_CAGRA index for the specified field. You can use entity.NewIndexGPUCagra()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexBinIvfFlat(metricType MetricType, intermediateGraphDegree, graphDegree int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of k-nearest neighbors (k) of this intermediate k-NN graph, trade off the quality of the final searchable CAGRA graph; It affects recall and build time by determining the graph's degree before pruning. Recommended values are |
| |
| CAGRA's optimized graph fixed-degree number. It affects search performance and recall by setting the graph's degree after pruning. A larger difference between these two degrees results in a longer build time. Its value must be smaller than the value of |
|
entity.IndexGPUIvfFlat
This struct type creates a GPU_IVF_FLAT index for the specified field. You can use entity.NewIndexGPUIvfFlat()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexGPUIvfFlat(metricType MetricType, nlist int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of cluster units. |
|
|
entity.IndexGPUIvfPQ
This struct type creates a GPU_IVF_PQ index for the specified field. You can use entity.NewIndexGPUIvfPQ()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexGPUIvfPQ(metricType MetricType, nlist int, m int, nbits int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of cluster units. |
|
|
| Number of factors of product quantization |
|
|
| Number of bits in which each low-dimensional vector is stored. |
|
|
entity.IndexHNSW
This struct type creates an HNSW index for the specified field. You can use entity.NewIndexHNSW()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexHNSW(metricType MetricType, M int, efConstruction int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Maximum number of outgoing connections in the graph. Higher M leads to higher accuracy/run_time at fixed ef/efConstruction. |
|
|
| Index search speed/build speed tradeoff. Increasing this parameter may enhance index quality, but it also tends to lengthen the indexing time. |
|
|
entity.IndexIvfFlat
This struct type creates an IVF_FLAT index for the specified field. You can use entity.NewIndexIvfFlat()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexIvfFlat(metricType MetricType, nlist int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of cluster units. |
|
|
In addition to the methods defined in the entity.Index
interface, this struct type also defines the following methods.
Method | Return Type | Description |
---|---|---|
|
| Returns whether |
entity.IndexIvfPQ
This struct type creates an IVF_PQ index for the specified field. You can use entity.NewIndexGPUIvfPQ()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexIvfPQ(metricType MetricType, nlist int, m int, nbits int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of cluster units. |
|
|
| Number of factors of product quantization |
|
|
| Number of bits in which each low-dimensional vector is stored. |
|
|
entity.IndexIvfSQ8
This struct type creates an IVF_SQ8 index for the specified field. You can use entity.NewIndexIvfSQ8()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexIvfSQ8(metricType MetricType, nlist int)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of cluster units. |
|
|
entity.IndexSCANN
This struct type creates a SCANN index for the specified field. You can use entity.NewIndexSCANN()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexSCANN(metricType MetricType, nlist int, with_raw_data bool)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Number of cluster units. |
|
|
| Whether to include raw data when creating the index. |
| N/A |
entity.IndexSparseInverted
This struct type creates a SPARSE_INVERTED_INDEX index for the specified field. You can use entity.NewIndexSparseInverted()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexSparseInverted(metricType MetricType, dropRatio float64)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Proportion of small vector values that are excluded during the indexing process. This option allows fine-tuning of the indexing process, making a trade-off between efficiency and accuracy by disregarding small values when building the index. |
|
|
entity.IndexSparseWAND
This struct type creates a SPARSE_WAND index for the specified field. You can use entity.NewIndexSparseWAND()
to create one for the client.CreateIndex()
request as follows:
index := entity.NewIndexSparseWAND(metricType MetricType, dropRatio float64)
Parameter | Description | Type | Value Range |
---|---|---|---|
| Metric type for Milvus to follow when it measures similarities between vector embeddings. |
| N/A |
| Proportion of small vector values that are excluded during the indexing process. This option allows fine-tuning of the indexing process, making a trade-off between efficiency and accuracy by disregarding small values when building the index. |
|
|
entity.IndexType
This string type defines all applicable index types.
const (
Flat IndexType = "FLAT" //faiss
BinFlat IndexType = "BIN_FLAT"
IvfFlat IndexType = "IVF_FLAT" //faiss
BinIvfFlat IndexType = "BIN_IVF_FLAT"
IvfPQ IndexType = "IVF_PQ" //faiss
IvfSQ8 IndexType = "IVF_SQ8"
HNSW IndexType = "HNSW"
AUTOINDEX IndexType = "AUTOINDEX"
DISKANN IndexType = "DISKANN"
SCANN IndexType = "SCANN"
GPUIvfFlat IndexType = "GPU_IVF_FLAT"
GPUIvfPQ IndexType = "GPU_IVF_PQ"
GPUCagra IndexType = "GPU_CAGRA"
GPUBruteForce IndexType = "GPU_BRUTE_FORCE"
// Sparse
SparseInverted IndexType = "SPARSE_INVERTED_INDEX"
SparseWAND IndexType = "SPARSE_WAND"
// DEPRECATED
Scalar IndexType = ""
Trie IndexType = "Trie"
Sorted IndexType = "STL_SORT"
Inverted IndexType = "INVERTED"
)