I Tried Hybrid Search (Vector + Full-Text) with Amazon S3 Vectors

I Tried Hybrid Search (Vector + Full-Text) with Amazon S3 Vectors

A single full-text search field can hold up to 100 KB and supports word-level search (BM25 ranking). I tried vector-only, full-text-only and hybrid search using DevelopersIO blog articles.
2026.11.17

This page has been translated by machine translation. View original

Introduction

On November 16, 2026, hybrid search for Amazon S3 Vectors was announced.

https://aws.amazon.com/jp/about-aws/whats-new/2026/11/s3-vectors-hybrid-search/

Previously, QueryVectors supported vector search and vector search filtered by metadata. With this update, full-text search has been added, and you can now run hybrid search, which combines vector search and full-text search, in a single QueryVectors call.

In this article, I prepared Japanese summary texts and an index for just over 40,000 DevelopersIO blog articles, and present the results of searching with Amazon S3 Vectors using three methods: vector only, full-text only, and hybrid.

Creating and Registering the Index

The measurements below were performed with boto3 1.44.4. In this version, you can specify queryTexts in QueryVectors and textSearchConfigurations in CreateIndex.

To use queryTexts, you need the IAM permission s3vectors:GetVectors in addition to s3vectors:QueryVectors. Without the GetVectors permission, you get an AccessDeniedException.

Creating the Index

Specify the metadata key to be targeted by full-text search in textSearchConfigurations of CreateIndex.

s3v = boto3.client("s3vectors", region_name="ap-northeast-1")
req = dict(
    vectorBucketName="<vector-bucket-name>",
    indexName="articles",
    dataType="float32",
    dimension=1024,
    distanceMetric="cosine",
    metadataConfiguration={"textSearchConfigurations": [{"metadataKey": "summary"}]},
)
s3v.create_index(**req)

I omitted language in textSearchConfigurations, so the Japanese summary is also indexed with the default standard analyzer.

Full-text search, hybrid search, and metadata prefiltering require an index in ENHANCED mode. The index mode inherits the bucket's defaultIndexMode, which was ENHANCED for the bucket used this time. I tried prefiltering in a previous article.

https://dev.classmethod.jp/articles/s3-vectors-enhanced-metadata-prefiltering/

GetVectorBucket and GetIndex responses right after creation (excerpt)

This is the defaultIndexMode of the bucket returned by GetVectorBucket.

"defaultIndexMode": "ENHANCED"

This is the metadataConfiguration and indexMode of the index returned by GetIndex.

"metadataConfiguration": {
  "nonFilterableMetadataKeys": [],
  "textSearchConfigurations": [
    {
      "metadataKey": "summary",
      "status": "ACTIVE"
    }
  ]
},
"indexMode": "ENHANCED"

Registering Vectors

Put the text you want to search with full-text search into the PutVectors metadata as summary.

items.append({
    "key": aid,
    "data": {"float32": [float(x) for x in vecs[pos]]},
    "metadata": {
        "language": m.get("language", ""),
        "published_year": int(m["published_at"][:4]),
        "slug": m.get("slug", ""),
        "title": m.get("title", ""),
        "summary": s["summary"],
    },
})

I registered the articles that have a Japanese summary (just over 40,000). For the vectors, I reused those already created with Nova 2.

How to Write Queries

Requests for the Three Methods

If you pass queryVector to QueryVectors, it searches by vector only; if you pass queryTexts, it searches by full-text only; if you pass both, it searches with hybrid.

kw = dict(vectorBucketName=B, indexName=I, topK=TOPK, returnMetadata=True, returnScores=True, returnDistance=True)
if mode in ("vector", "hybrid"):
    kw["queryVector"] = {"float32": vec}
if mode in ("text", "hybrid"):
    kw["queryTexts"] = [{"metadataKey": "summary", "text": text}]
r = s3v.query_vectors(**kw)

mode is one of vector, text, or hybrid; B and I are the bucket name and index name; TOPK is 10. The search term passed in one element of queryTexts can be up to 1,024 characters.

Scores for full-text only and hybrid are returned when returnScores is true. For vector only, the distance is returned when returnDistance is true.

How Scores Are Returned

These are the 1st to 3rd results of the hybrid response for the query Graviton3E described later (metadata is omitted).

{
  "distance": 0.5577852129936218,
  "scores": {
    "fused": 0.03226646035909653,
    "bm25Scores": [
      {
        "metadataKey": "summary",
        "score": 9.29963493347168
      }
    ],
    "vectorDistance": 0.5577852129936218
  },
  "key": "wp-post-981825"
},
{
  "distance": 0.5569610595703125,
  "scores": {
    "fused": 0.01666666753590107,
    "vectorDistance": 0.5569610595703125
  },
  "key": "wp-post-1100053"
},
{
  "scores": {
    "fused": 0.01666666753590107,
    "bm25Scores": [
      {
        "metadataKey": "summary",
        "score": 11.153423309326172
      }
    ]
  },
  "key": "wp-post-990881"
}

scores contains only the scores of the methods in which the article ranked high. fused is a value from Reciprocal Rank Fusion (RRF). From the rank r in each method (with 1st place as 0), 1/(60 + r) is calculated and summed. Values calculated with this formula matched fused in the response within float32 error. The first result's 0.03226646 is 1/61 + 1/63, from 2nd place on the vector side and 4th place on the full-text side. Only the rank in each method determines fused.

An article that appears in only one method has about 0.01667 (1/60) even if it is ranked 1st. An article ranked 1st in both methods gets about 0.0333. Articles with the same rank that appear in only one method have the same fused value.

Search Result Examples

The query vectors were created with Nova 2 (amazon.nova-2-multimodal-embeddings-v1:0) in us-east-1, with embeddingPurpose set to TEXT_RETRIEVAL and dimensions set to 1024. For vector only, I passed this vector as queryVector; for full-text only, I passed the query sentence as queryTexts; for hybrid, I passed both; all were run with topK=10. For two queries, the titles of the top 5 results are shown.

Query Specifying a Term

The query is Graviton3E.

Vector Only

Rank Title
1 Hpc7g instances powered by AWS Graviton 3E, optimized for HPC, are now generally available
2 AWS Graviton Delivery Partners were introduced #reinvent
3 [Breaking News] Nitro v5 and Graviton 3E, C7gn, and Hpc7g instances were announced
4 I built a cost-effective Redmine environment using Graviton3
5 M7g (general purpose) and R7g (memory optimized): new EC2 instances powered by AWS Graviton 3 have been released

Full-Text Only

Rank Title
1 [Report] Scaling network performance on next-gen Amazon EC2 instances #CMP333 #reinvent
2 A roundup of re:Invent 2022 HPC-related updates #reinvent
3 I attended re:Invent 2022 re:Cap 2nd Night #awsbasics #reInvent
4 AWS Graviton Delivery Partners were introduced #reinvent

Full-text-only results may be fewer than 10. For this query, there were 4.

Hybrid

Rank Title
1 AWS Graviton Delivery Partners were introduced #reinvent
2 Hpc7g instances powered by AWS Graviton 3E, optimized for HPC, are now generally available
3 [Report] Scaling network performance on next-gen Amazon EC2 instances #CMP333 #reinvent
4 A roundup of re:Invent 2022 HPC-related updates #reinvent
5 [Breaking News] Nitro v5 and Graviton 3E, C7gn, and Hpc7g instances were announced

Query Written as a Sentence

The query is "I want to read replies that arrived at an email delivery service in the email client I normally use."

Vector Only

Rank Title
1 I tried receiving emails replied to SES in an email client
2 I tried replying to emails with Amazon SES and Amazon WorkMail
3 I tried sending game event announcement emails with SendGrid
4 AWS Beginner Blog Relay 2024 ~ Amazon Simple Email Service (Amazon SES) Edition ~
5 Forwarding tickets to brand-specific email addresses with Zendesk action flows × SendGrid API

Full-Text Only

Rank Title
1 [Quick Tip] Items to check when emails don't arrive with opswitch's email notification settings
2 I tried sending game event announcement emails with SendGrid
3 Gatsby isn't just for static sites. I built a contact form with Gatsby Functions.
4 [Auth0] Sending a password reset email to a user using the Authentication API
5 Amazon Connect Email now supports automatic email replies based on keyword detection! #AWSreInvent

Hybrid

Rank Title
1 I tried sending game event announcement emails with SendGrid
2 I tried individually resolving emails that may be treated as spam
3 I tried receiving emails replied to SES in an email client
4 [Quick Tip] Items to check when emails don't arrive with opswitch's email notification settings
5 I tried replying to emails with Amazon SES and Amazon WorkMail

Summary

Previously, Amazon S3 Vectors metadata filters could be used for exact match, prefix match (ENHANCED), numeric comparison, and so on. With this update, word-level full-text search (with BM25 ranking) has become possible.

In this verification, the summary texts were short enough to fit within the 2 KB of metadata per vector. Even for longer texts, if you also specify the full-text search key in nonFilterableMetadataKeys, you can keep up to 100 KB per field (about 33,000 Japanese characters in UTF-8), separate from the 2 KB limit.

The newly supported hybrid search may improve the search accuracy of Amazon S3 Vectors by combining the results of vector search and full-text search. If you have had accuracy problems with the previous combination of vector search and metadata filters, such as search terms not being easily matched, please try this update.

Share this article

AWSのお困り事はクラスメソッドへ