All Products
Search
Document Center

Tablestore:KnnVectorQuery

Last Updated:Jul 26, 2024

Uses the k-nearest neighbor (KNN) vector query feature to perform an approximate nearest neighbor search based on vectors. This way, you can find data items that have the highest similarity as the vector that you want to query in a large-scale 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;
}

Parameter

Type

Required

Description

field_name

string

Yes

The name of the vector field.

top_k

int32

Yes

The top K query results that have the highest similarity as the vector that you want to query. For more information, see Search index limits.

float32_query_vector

float

Yes

The vector for which you want to query the similarity.

filter

Query

No

The filter. You can use a combination of query conditions that are not KNN vector query conditions.

weight

float

No

The weight configurations of the query condition.