Search
ANN in S3 Vectors, document hydration from DynamoDB.
Provide a query string (embedded for you) or a raw vector. S3 Vectors returns the
nearest keys; dynavec hydrates the full documents from DynamoDB via BatchGetItem.
hits = db.search(
"how do cells make energy?",
top_k=5,
namespace="kb",
filter={"topic": "biology"}, # metadata pre-filter (S3 Vectors)
)
for h in hits:
print(h.score, h.id, h.text, h.metadata)
Metadata filtering
Filters use the S3 Vectors dialect — bare {"k": v} is equality; operators like
$gte, $in, $and, $or are supported. Only keys in
filterable_keys can be filtered.
db.search("q", filter={"$and": [{"topic": "bio"}, {"year": {"$gte": 2020}}]})
Results come back as SearchResult with id, score (higher = more
similar), distance, text, and metadata. Refine ordering with
metrics & rerank, speed up repeats with
caching.