Returns matching vector keys from a vector index ranked by vector similarity, full-text relevance, or both. Specify
queryVector to perform a vector search, specify
queryTexts to perform a full-text search, or specify both to perform a hybrid search. Full-text search ranks results using BM25. Hybrid search combines the vector and full-text rankings using Reciprocal Rank Fusion (RRF).
Amazon S3 Vectors ranks results by distance for a vector-only search, by BM25 score for a full-text-only search, and by RRF score for a hybrid search. You can optionally include computed distances, relevance scores, and vector metadata in the response. Full-text and hybrid searches require a vector index in
ENHANCED mode.
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 queryTexts, don't set any metadata filters, and don't request metadata (by keeping the returnMetadata parameter set to false or not specified).
- To use queryTexts, a metadata filter, or returnMetadata set to true with this operation, you must have both the s3vectors:QueryVectors and s3vectors:GetVectors permissions. If you use any of these options without the s3vectors:GetVectors permission, Amazon S3 Vectors returns an AccessDeniedException.
This cmdlet automatically pages all available results to the pipeline - parameters related to iteration are only needed if you want to manually control the paginated output. To disable autopagination, use -NoAutoIteration.