All Products
Search
Document Center

Tablestore:KnnVectorQuery

Last Updated:Apr 14, 2026

KnnVectorQuery performs an approximate nearest neighbor search to find the top-k most similar vectors in a dataset.

Data structure

message KnnVectorQuery {
    optional string field_name = 1;
    optional int32 top_k = 2;
    repeated float float32_query_vector = 4;
    optional Query filter = 5;
    optional float weight = 6;
    optional float min_score = 7;
}

Parameter

Type

Required

Description

field_name

string

Yes

The name of the vector field to search.

top_k

int32

Yes

The number of nearest neighbors to return. For the maximum value, see Search Index limits.

float32_query_vector

float

Yes

The query vector used for the similarity search. The dimension of this vector must match the dimension of the target vector field.

filter

Query

No

A query filter that combines any non-vector query conditions to narrow results before the vector search.

weight

float

No

The weight assigned to this query in a composite query. A higher value increases the influence of this query on the final relevance score.

min_score

float

No

The minimum score threshold. Only rows with a score greater than this value are returned. Valid values: greater than or equal to 0. Default value: 0.