Retrieve vector entries from an index by their primary keys.
Permissions
By default, an Alibaba Cloud account has full permissions. Resource Access Management (RAM) users and RAM roles have no permissions by default. Grant the required permissions through a RAM policy or a bucket policy.
| API | Action | Description |
|---|---|---|
| GetVectors | oss:GetVectors | Gets vector data. |
Syntax
ossutil vectors-api get-vectors --bucket <value> --index-name <value> --keys <value> [flags]Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
--bucket | string | Yes | The name of the vector bucket. |
--index-name | string | Yes | The name of the index. |
--keys | strings | Yes | The primary keys of the vectors to retrieve. Duplicate primary keys are allowed. |
--return-data | — | No | Whether to return vector data. Returned by default when omitted or set to true. |
--return-metadata | — | No | Whether to return metadata. Returned by default when omitted or set to true. |
Limits
| Constraint | Limit |
|---|---|
| Unique keys per request | 1–100 |
| Key length | 1–1,024 |
Examples
Retrieve vectors by primary key. Both vector data and metadata are returned by default. Use --return-data and --return-metadata to control which fields are included.
Retrieve vectors with primary keys
keyandkey1from the indexindexin the vector bucketexamplebucket:ossutil vectors-api get-vectors --bucket examplebucket --index-name index --keys key,key1Return vector data explicitly:
ossutil vectors-api get-vectors --bucket examplebucket --index-name index --keys key,key1 --return-dataReturn metadata explicitly:
ossutil vectors-api get-vectors --bucket examplebucket --index-name index --keys key,key1 --return-metadataReturn both vector data and metadata explicitly:
ossutil vectors-api get-vectors --bucket examplebucket --index-name index --keys key,key1 --return-data --return-metadata
Usage notes
The
get-vectorscommand maps to the GetVectors API operation.For supported global flags, see Global command line options.