query-vectors-fusion
The query-vectors-fusion command queries a Fusion-mode vector index.
Permissions
By default, an Alibaba Cloud account has full permissions, whereas a RAM user or RAM role has none. The Alibaba Cloud account owner or an administrator must grant permissions by using a RAM policy or a bucket policy.
|
API |
Action |
Description |
|
QueryVectors |
|
Queries vector data. |
Permissions
By default, an Alibaba Cloud account has full permissions. In contrast, RAM users and RAM roles have no permissions and must be granted access by an account owner or administrator through a RAM policy or a bucket policy.
|
API |
Action |
Description |
|
QueryVectorsFusion |
|
Queries vector data in Fusion mode. |
Command format
ossutil vectors-api query-vectors-fusion --bucket value --index-name value --account-id value [flags]
Parameters
|
Parameter |
Type |
Description |
|
--bucket |
string |
The name of the vector bucket. |
|
--index-name |
string |
The name of the vector index. |
|
--account-id |
string |
The ID of the Alibaba Cloud account. This option is required. If it is not specified, the command returns the |
|
--knn |
string |
The vector search condition, in JSON format. If the option value contains the |
|
--query |
string |
The container of scalar and full-text filter conditions, in JSON format. If the option value contains the |
|
--retriever |
string |
The multi-channel hybrid retrieval configuration, in JSON format. Used for fusion of multiple recall channels, such as RRF fusion and weighted normalization fusion. |
|
--limit |
int |
The number of entries to return. |
|
--next-token |
string |
The token from which the query starts. Set the value to the NextToken value returned in the previous request. |
|
--partition-keys |
stringArray |
The partition keys to access. You can specify this option multiple times to pass multiple partition keys. |
|
--return-metadata |
/ |
Specifies whether to return metadata. Metadata is returned if this option is specified. |
|
--return-metadata-fields |
stringArray |
The metadata fields to return. You can specify this option multiple times to pass multiple fields. |
|
--sort |
string |
The sort order of the returned entries, in JSON format. |
-
This command requires ossutil 2.4.1 or later. For earlier versions, call the QueryVectorsFusion operation by using the
invoke-operationgeneric command. -
--knn,--query, and--retrievercorrespond to vector search, scalar and full-text filtering, and fusion of multiple recall channels respectively. You can combine them as needed. -
When you use
--retriever, you can specify only the following options at the same time:--index-name,--limit,--partition-keys,--return-metadata, and--return-metadata-fields. -
--next-tokensupports pagination only for queries that use scalar and full-text filtering alone, that is, queries in which neither--knnnor--retrieveris specified. -
For more information about the supported global command-line options, see Supported global command-line options.
Usage examples
In the vector bucket named examplebucket, query the Fusion-mode vector index named my_index to return the top 10 vectors that are most similar to the query vector, along with their metadata.
ossutil vectors-api query-vectors-fusion --bucket examplebucket --index-name my_index --knn '{"field":"text_vector","queryVector":[0.1,0.2,0.3],"topK":10,"numCandidates":100}' --return-metadata --account-id 123456789012****
Add a scalar filter to the preceding query to return only the entries whose category is book, limit the result to 20 entries, and return only the title and year metadata fields.
ossutil vectors-api query-vectors-fusion --bucket examplebucket --index-name my_index --knn '{"field":"text_vector","queryVector":[0.1,0.2,0.3],"topK":10,"numCandidates":100}' --query '{"category":{"$eq":"book"}}' --limit 20 --return-metadata --return-metadata-fields title --return-metadata-fields year --account-id 123456789012****