Skip to main content

SearchParams

The types on this page implemented the method signatures of the entity.SearchParam interface.

IndexAUTOINDEXSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with AUTOINDEX.

You can use the entity.NewIndexAUTOINDEXSearchParam() method to instantiate this type as follows.

searchParams := entity.NewIndexAUTOINDEXSearchParam(level int)

Parameter

Type

Value Range

Description

level

int

[1, 5]

The precision level of the search.

Increasing the level parameter will result in a higher recall rate, but may also lead to degraded search performance. The value defaults to 1 and ranges from 1 to 5. The default value results in a recall rate of 90%, which is typically sufficient for most use cases. However, if you require a higher recall rate, increase this value.

IndexBinFlatSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with BIN_FLAT.

You can use the entity.NewIndexBinFlatSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexBinFlatSearchParam(nprobe int)

Parameter

Type

Value Range

Description

Default

nprobe

int

[1, nlist]

Number of units to query

8

IndexDISKANNSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with DiskANN.

You can use the entity.NewIndexDISKANNSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexDISKANNSearchParam(search_list int)

Parameter

Type

Value Range

Description

search_list

int

[topk, int32_max]

Size of the candidate list, a larger size offers a higher recall rate with degraded performance.

IndexFlatSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with FLAT.

You can use the entity.NewIndexFlatSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexFlatSearchParam()

IndexGPUBruteForceSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with GPU_BRUTE_FORCE.

You can use the entity.NewIndexGPUBruteForceSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexGPUBruteForceSearchParam()

IndexGPUCagraSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with GPU_CAGRA.

You can use the entity.NewIndexGPUCagraSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexGPUCagraSearchParam(
itopkSize int,
searchWidth int,
minIterations int,
maxIterations int,
teamSize int,
)

Parameter

Type

Description

Default

itopkSize

int

Determines the size of intermediate results kept during the search. A larger value may improve recall at the expense of search performance. It should be at least equal to the final top-k (limit) value and is typically a power of 2 (e.g., 16, 32, 64, 128).

N/A

searchWidth

int

Specifies the number of entry points into the CAGRA graph during the search. Increasing this value can enhance recall but may impact search performance(e.g. 1, 2, 4, 8, 16, 32).

N/A

minIterations

int

Controls the search iteration process. By default, they are set to 0, and CAGRA automatically determines the number of iterations based on itopkSize and searchWidth. Adjusting these values manually can help balance performance and accuracy.

0

maxIterations

int

teamSize

int

Specifies the number of CUDA threads used for calculating metric distance on the GPU. Common values are a power of 2 up to 32 (e.g. 2, 4, 8, 16, 32). It has a minor impact on search performance. The default value is 0, where Milvus automatically selects the teamSize based on the vector dimension.

0

IndexGPUIvfFlatSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with GPU_IVF_FLAT.

You can use the entity.NewIndexGPUIvfFlatSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexGPUIvfFlatSearchParam(nprobe int)

Parameter

Type

Value Range

Description

Default

nprobe

int

[1, 65535]

Number of cluster units

128

IndexGPUIvfPQSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with GPU_IVF_PQ.

You can use the entity.NewIndexGPUIvfPQSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexGPUIvfPQSearchParam(nprobe int)

Parameter

Type

Value Range

Description

Default

nprobe

int

[1, 65535]

Number of cluster units

128

IndexHNSWSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with HNSW.

You can use the entity.NewIndexHNSWSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexHNSWSearchParam(ef int)

Parameter

Type

Value Range

Description

ef

int

[top_k, int_max]

Parameter controlling query time/accuracy trade-off. Higher ef leads to more accurate but slower search.

IndexIvfFlatSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with IVF_FLAT.

You can use the entity.NewIndexIvfFlatSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexIvfFlatSearchParam(nprobe int)

Parameter

Type

Value Range

Description

Default

nprobe

int

[1, nlist]

Number of units to query

8

IndexIvfPQSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with IVF_PQ.

You can use the entity.NewIndexIvfPQSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexIvfPQSearchParam(nprobe int)

Parameter

Type

Value Range

Description

Default

nprobe

int

[1, nlist]

Number of units to query

8

IndexIvfSQ8SearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with IVF_SQ8.

You can use the entity.NewIndexIvfSQ8SearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexIvfSQ8SearchParam(nprobe int)

Parameter

Type

Value Range

Description

Default

nprobe

int

[1, nlist]

Number of units to query

8

IndexSCANNSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with SCANN.

You can use the entity.NewIndexSCANNSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexSCANNSearchParam(nprobe int, reorder_k int)

Parameter

Type

Value Range

Description

nprobe

int

[1, nlist]

Number of units to query

reorder_k

int

[ topK, ∞]

Number of candidate units to query

IndexSparseInvertedSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with SPARSE_INVERTED_INDEX.

You can use the entity.NewIndexSparseInvertedSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexSparseInvertedSearchParam(dropRatio int)

Parameter

Type

Value Range

Description

dropRatio

float64

[0, 1]

The proportion of small vector values that are excluded during the search process. This option allows fine-tuning of the search process by specifying the ratio of the smallest values in the query vector to ignore. It helps balance search precision and performance. The smaller the value set for dropRaio, the less these small values contribute to the final score. By ignoring some small values, search performance can be improved with minimal impact on accuracy.

IndexSparseWANDSearchParam

This struct type defines the search parameters of a similarity search within a collection indexed with SPARSE_WAND.

You can use the entity.NewIndexSparseWANDSearchParam() method to instantiate this type as follows:

searchParams := entity.NewIndexSparseWANDSearchParam(dropRatio int)

Parameter

Type

Value Range

Description

dropRatio

float64

[0, 1]

The proportion of small vector values that are excluded during the search process. This option allows fine-tuning of the search process by specifying the ratio of the smallest values in the query vector to ignore. It helps balance search precision and performance. The smaller the value set for dropRaio, the less these small values contribute to the final score. By ignoring some small values, search performance can be improved with minimal impact on accuracy.