2026/06/16 - Amazon S3 Vectors - 1 updated api methods
Changes Amazon S3 Vectors now supports paginated QueryVectors requests, returning up to 10,000 results per query.
{'nextToken': 'string'}
Performs an approximate nearest neighbor search query in a vector index using a query vector. By default, it returns the keys of approximate nearest neighbors. You can optionally include the computed distance (between the query vector and each vector in the response) and metadata of each vector in the response.
To specify the vector index, you can either use both the vector bucket name and the vector index name, or use the vector index Amazon Resource Name (ARN).
Permissions
You must have the s3vectors:QueryVectors permission to use this operation. Additional permissions are required based on the request parameters you specify:
With only s3vectors:QueryVectors permission, you can retrieve vector keys of approximate nearest neighbors and computed distances between these vectors. This permission is sufficient only when you don't set any metadata filters and don't request metadata (by keeping the returnMetadata parameter set to false or not specified).
If you specify a metadata filter or set returnMetadata to true, you must have both s3vectors:QueryVectors and s3vectors:GetVectors permissions. The request fails with a 403 Forbidden error if you request metadata filtering or metadata without the s3vectors:GetVectors permission.
See also: AWS API Documentation
Request Syntax
client.query_vectors(
vectorBucketName='string',
indexName='string',
indexArn='string',
topK=123,
queryVector={
'float32': [
...,
]
},
filter={...}|[...]|123|123.4|'string'|True|None,
returnMetadata=True|False,
returnDistance=True|False,
nextToken='string'
)
string
The name of the vector bucket that contains the vector index.
string
The name of the vector index that you want to query.
string
The ARN of the vector index that you want to query.
integer
[REQUIRED]
The number of results to return for each query.
dict
[REQUIRED]
The query vector. Ensure that the query vector has the same dimension as the dimension of the vector index that's being queried. For example, if your vector index contains vectors with 384 dimensions, your query vector must also have 384 dimensions.
float32 (list) --
The vector data as 32-bit floating point numbers. The number of elements in this array must exactly match the dimension of the vector index where the operation is being performed.
(float) --
:ref:`document<document>`
Metadata filter to apply during the query. For more information about metadata keys, see Metadata filtering in the Amazon S3 User Guide.
boolean
Indicates whether to include metadata in the response. The default value is false.
boolean
Indicates whether to include the computed distance in the response. The default value is false.
string
Pagination token from a previous request. The value of this field is empty for an initial request.
dict
Response Syntax
{
'vectors': [
{
'distance': ...,
'key': 'string',
'metadata': {...}|[...]|123|123.4|'string'|True|None
},
],
'distanceMetric': 'euclidean'|'cosine',
'nextToken': 'string'
}
Response Structure
(dict) --
vectors (list) --
The vectors in the approximate nearest neighbor search.
(dict) --
The attributes of a vector in the approximate nearest neighbor search.
distance (float) --
The measure of similarity between the vector in the response and the query vector.
key (string) --
The key of the vector in the approximate nearest neighbor search.
metadata (:ref:`document<document>`) --
The metadata associated with the vector, if requested.
distanceMetric (string) --
The distance metric that was used for the similarity search calculation. This is the same distance metric that was configured for the vector index when it was created.
nextToken (string) --
Pagination token to be used in the subsequent page request. The field is empty if no further pagination is required.