Skip to content

What is hybrid search?

Mikhail Bodnarchuk

Definition

Hybrid search is a retrieval method that runs a keyword search and a vector search for the same query and merges the two ranked lists into one. Keyword matching catches exact codes and names, vector similarity catches paraphrases, and a fusion step such as reciprocal rank fusion decides the final order.

How does hybrid search work?

Hybrid search sends one user query down two paths and merges what comes back:

  1. Keyword path. A full-text query, usually ranked with BM25, finds documents that contain the query's words.
  2. Vector path. The query is embedded, and a nearest-neighbor search finds documents whose vectors sit close to it.
  3. Fusion. The two ranked lists become one, either by rank position or by normalized score (next section).
  4. Optional re-ranking. A slower model reorders the top of the fused list.
  5. Return the top results, often as context for a model's answer.

The two paths run in parallel. In Microsoft's search service, now documented as Foundry IQ (Azure AI Search), a full-text query plus one vector query counts as two query executions, and adding vector fields adds more. Its semantic ranker, when enabled, runs after the lists are merged.

The merge step is where the design decisions are. The raw scores cannot simply be added: the same Azure page lists BM25 scores as having no upper limit, while cosine scores from its vector search fall between 0.333 and 1.00. A BM25 score of 14 would drown any cosine score.

Rank fusion or score fusion: which should you use?

There are two families of fusion, and engines name them differently.

Rank fusion (RRF)Score fusion (normalize, then combine)
What it usesEach document's position in each listEach document's score, rescaled to a common range
FormulaSum of 1 / (k + rank) across lists; Weaviate's example uses 60, and Azure says it performs best with "a small value, such as 60"For example min-max to 0..1, then a weighted sum
Keeps the gap between results?No: each rank gets a fixed score, however far apart the original scores wereYes
Needs tuning?LittleWeights, and the normalization method
Names in enginesWeaviate rankedFusion, OpenSearch rrf, every Azure hybrid queryWeaviate relativeScoreFusion, OpenSearch min_max, l2 or z_score

OpenSearch's hybrid search docs give a clear rule for choosing. Pick score-based combination when the difference between two documents' scores carries information the final ranking must reflect. Pick rank-based combination when you want a setup that works without first measuring how each query clause scores documents.

Weaviate changed its default from rank fusion to relativeScoreFusion in version 1.24. Its hybrid search concepts page says relative score fusion "might be a good choice, which is why it is the default", because it keeps more information from the original searches than ranks alone.

Example: the same two lists, fused four ways

The script below merges one keyword list and one vector list for the query "ER-4031 payment failed". The scores are made up so the effect is easy to see: only one help article contains the error code, so it leads the keyword list by a wide margin, while the four vector results score between 0.74 and 0.83. The last line checks the normalization against the worked example in Weaviate's docs.

# Two ways to merge a keyword list and a vector list: rank fusion and score fusion.
# Scores below are made up for the query "ER-4031 payment failed"; no search engine needed.

def rrf(*lists, k=60):
    """Reciprocal rank fusion: each list adds 1 / (k + rank), rank starting at 1."""
    fused = {}
    for scores in lists:
        ranked = sorted(scores, key=scores.get, reverse=True)
        for rank, doc in enumerate(ranked, start=1):
            fused[doc] = fused.get(doc, 0) + 1 / (k + rank)
    return fused

def relative_score(keyword, vector, alpha):
    """Min-max normalize each list to 0..1, then alpha * vector + (1 - alpha) * keyword."""
    def norm(s):
        lo, hi = min(s.values()), max(s.values())
        return {d: (v - lo) / (hi - lo) for d, v in s.items()}
    kw, vec = norm(keyword), norm(vector)
    return {d: alpha * vec.get(d, 0) + (1 - alpha) * kw.get(d, 0) for d in kw.keys() | vec.keys()}

def top(fused, n=3):
    return ", ".join(f"{d} {fused[d]:.4f}" for d in sorted(fused, key=fused.get, reverse=True)[:n])

# BM25 scores: only one article contains the code, so it leads by a wide margin.
keyword = {"er-4031-guide": 14.2, "card-declined": 3.1, "refund-policy": 1.4, "checkout-faq": 1.2}
# Cosine similarity: several articles are about failed payments, and they score close together.
vector = {"card-declined": 0.83, "checkout-faq": 0.81, "payment-methods": 0.80, "er-4031-guide": 0.74}

print("RRF (k=60):          ", top(rrf(keyword, vector)))
print("relative, alpha 0.75:", top(relative_score(keyword, vector, 0.75)))
print("relative, alpha 0.5: ", top(relative_score(keyword, vector, 0.5)))
print("relative, alpha 0.25:", top(relative_score(keyword, vector, 0.25)))

# Check against the worked example in Weaviate's hybrid search docs (expected 1.0 0.511 0.45 0.022 0.0).
kw_ex = {1: 5, 0: 2.6, 2: 2.3, 4: 0.2, 3: 0.09}
vec_ex = {2: 0.6, 4: 0.598, 0: 0.596, 1: 0.594, 3: 0.009}
kw_only = relative_score(kw_ex, vec_ex, alpha=0)
print("Weaviate example, keyword side:", [round(kw_only[d], 3) for d in (1, 0, 2, 4, 3)])

We ran it with python3 fuse.py (Python 3.11). Output:

RRF (k=60):           card-declined 0.0325, er-4031-guide 0.0320, checkout-faq 0.0318
relative, alpha 0.75: card-declined 0.7865, checkout-faq 0.5833, payment-methods 0.5000
relative, alpha 0.5:  card-declined 0.5731, er-4031-guide 0.5000, checkout-faq 0.3889
relative, alpha 0.25: er-4031-guide 0.7500, card-declined 0.3596, checkout-faq 0.1944
Weaviate example, keyword side: [1.0, 0.511, 0.45, 0.022, 0.0]

Three things stand out:

  • At alpha 0.75 the exact match drops out of the top three. Min-max scaling turns the lowest score in a list into 0, even when that score (0.74) is still a decent match. The article with the error code gets nothing from the vector side and only a quarter weight on the keyword side.
  • RRF keeps it in second place, because RRF only sees that it ranked first in one list and fourth in the other. The cost is that RRF also ignores how far ahead it was: its top three fused scores sit within 0.0008 of each other.
  • Weights move the answer more than the method. Shifting alpha from 0.75 to 0.25 puts the error-code article first.

Your own scores will differ, so test these settings on real queries instead of copying ours.

What does the alpha parameter control?

In Weaviate, alpha sets the weight of the vector side: 0 is keyword search only, 1 is vector search only, and 0.5 weighs both equally. The server default is 0.75, but the docs warn that client libraries do not all leave alpha unset, so depending on client and server version the effective weighting can differ from 0.75, and in some cases can be a pure keyword search. Their advice is to set alpha explicitly whenever the weighting matters.

Azure exposes the same idea as a weight per vector query. The default of 1.0 leaves a list's RRF contribution as is; 0.5 halves it and 2.0 doubles it.

How is hybrid search different from semantic search?

Semantic search is the vector path on its own: it ranks by meaning and is weak on exact identifiers. Hybrid search keeps that path and adds the keyword path back, so codes, names and rare terms still match. The question is not which one to use, but how much weight each side gets and how the lists are merged.

What should you check before shipping hybrid search?

  1. A labeled query set that includes identifiers. Product codes, error IDs and names are where the two paths disagree most. Score every fusion setting on it.
  2. Alpha and fusion method set in code. Do not rely on server or client defaults; Weaviate's own docs show they can differ.
  3. Candidate window sizes. Azure returns the top 50 matches of the fused list by default and caps the text side at 1,000 matches unless you raise maxTextRecallSize. In OpenSearch, a search pipeline takes each subquery's top results per shard, so the candidate set grows with the number of shards; fusion mode takes a fixed window across all shards.
  4. No thresholds on fused scores. RRF scores depend on how many lists were merged. Weaviate offers a maximum vector distance, but it applies only to the vector side, and there is no BM25 or combined-score equivalent.
  5. Permissions before fusion. Filter both paths by what the user may see, not only the final list.

Our AI-ready data engine work indexes unstructured content for vector and hybrid search, on pgvector, Elasticsearch, OpenSearch, Qdrant or Weaviate. Access rules travel with the data, so an assistant never shows a user a document they could not open themselves. Our report on AI-ready data covers what the content needs first.

Sources

  1. Relevance scoring in hybrid search using Reciprocal Rank Fusion (RRF), Microsoft Learn (Foundry IQ, Azure AI Search), 2026-11-17
  2. Hybrid search, OpenSearch Documentation, 2026-11-06
  3. Hybrid search, Weaviate Documentation, 2026-09-19
  4. pgvector, pgvector (GitHub README), 2026-11-18

Frequently asked questions

Is hybrid search better than vector search for RAG?

It helps when questions mix plain language with names, codes or rare terms, because the keyword side still matches them. Measure both on your own labeled questions before you decide.

Do I need a separate vector database for hybrid search?

Not always. OpenSearch runs both in one hybrid query, and the pgvector README suggests pairing it with Postgres full-text search, then merging the results with reciprocal rank fusion or a cross-encoder.

What alpha value should I start with?

Start at 0.5, so both sides weigh the same, then move it in steps on a labeled query set. Lower values favor exact keyword matches, higher values favor meaning.

Does hybrid search cost more than one search?

Yes. Each request runs at least two queries and one embedding call for the query text, plus the fusion step and any re-ranker on top.

Mikhail BodnarchukMikhail BodnarchukFounder of Codeception and CodeceptJSBoth are open-source testing frameworks: Codeception for PHP, CodeceptJS for JavaScript.LinkedInGitHub

Building with AI agents? Talk to an engineer.