Skip to content

DynamoDBClient.search_vectors

rboto-dynamodb==0.4.0 · Service index · Types

Model summary (excerpt): Performs a vector similarity search on a vector index associated with an Amazon DynamoDB table, and returns the most similar items sorted by similarity score based on the distance function configured for the index. Score interpretation depends on the distance function: COSINE - Returns the items with the k smallest scores. Scores range from 0 (identical) to 2 (opposite). Lower scores indicate...

Install and imports

python -m pip install "rboto[dynamodb]==0.4.0"
from rboto import DynamoDBClient
from collections.abc import Sequence
from rboto_dynamodb.types import (
    AttributeValue,
    ReturnConsumedCapacity,
    SearchVectorsOutput,
)

Signature

async def search_vectors(
    *,
    table_name: str,
    index_name: str,
    search_vector: Sequence[AttributeValue],
    top_k: int,
    return_consumed_capacity: ReturnConsumedCapacity | None = None,
    expression_attribute_names: dict[str, str] | None = None,
    expression_attribute_values: dict[str, AttributeValue] | None = None,
    projection_expression: str | None = None,
    search_condition_expression: str | None = None,
) -> SearchVectorsOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
table_name Yes The name or Amazon Resource Name (ARN) of the table containing the vector index.
index_name Yes The name of the vector index to search. The index must be in the ACTIVE state.
search_vector Yes The search vector to compare against the indexed vectors. Each element is a 32-bit IEEE-754 floating point number, provided in DynamoDB list format. The number of dimensions must match the number of dimensions configured for the vector index.
top_k Yes The number of most similar results to return.
return_consumed_capacity No
expression_attribute_names No One or more substitution tokens for attribute names in an expression. Use the # character in an expression to dereference an attribute name.
expression_attribute_values No One or more values that can be substituted in an expression. Use the : character in an expression to dereference an attribute value.
projection_expression No A string that identifies one or more attributes to retrieve from the index. Separate attribute names with commas. If not specified, the operation returns all attributes projected into the vector index. Only attributes projected into the vector index can be retrieved.
search_condition_expression No A condition expression used to filter the vector search results. The expression can reference attributes defined in the vector index search schema, including HASH and INLINE_FILTER key elements. The HASH and INLINE_FILTER attributes support only the equality operator ( = ). You can reference only top-level attributes from the search schema.

Output

SearchVectorsOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
consumed_capacity VectorCapacityOutput | None Always present VectorCapacityOutput
search_results list[SearchResultItemOutput] | None Always present SearchResultItemOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

AttributeValue, ReturnConsumedCapacity, SearchVectorsOutput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_dynamodb.exceptions:

InternalServerError, RequestLimitExceededError, ResourceNotFoundError, ThrottlingError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model