Skip to main content
A hybrid query combines vector search with lexical search to achieve better relevance by leveraging both semantic similarity and keyword matching. Full-text search and vector search use different scoring mechanisms: text relevance depends on term and document frequency, while vector relevance scores derive from the configured similarity metric. Without proper normalization, one search method may dominate the results, leading to suboptimal ranking. Hybrid queries address this by combining and normalizing scores from both methods. LambdaDB supports rrf (Reciprocal Rank Fusion), mm (min-max), l2 (L2 norm), and bayesian fusion to combine results from different query types. Bayesian fusion is available to all users.
Hybrid fusion scores are in [0,1], but they are not relevance probabilities. The highest returned score is not necessarily 1.
With native reranking, fusion runs first. Applied reranking returns its evaluation value as score and the fused value as retrievalScore. Fallback retains the fused scores and order from the expanded candidate pool.

Parameters

Rescoring methods

How scores are combined

Fusion uses the candidates retrieved by each of the two query paths. A document missing from one path contributes zero from that path. Changing candidate depth can change scores and ordering, so compare retrieval settings as well as the fusion method when evaluating results. For example, L2 normalization changes path scores [3, 4] to [0.6, 0.8]. If a document has normalized scores 0.8 and 0.4 on the two paths and boosts 0.7 and 0.3, its fused score is 0.7 * 0.8 + 0.3 * 0.4 = 0.68. Omitting both boosts gives each path a weight of 0.5. For Bayesian fusion, sigmoid(x) = 1 / (1 + exp(-x)) and ln is the natural logarithm. Calibration uses each path’s globally merged, retained candidates. When the population standard deviation is at most 1e-12, the scale is 1 instead of its inverse. For example, a document at the median of both paths has p = 0.5 on each, giving a fused score of about 0.727. If it appears at the median of only one path, its score is about 0.620. These are heuristic scores, not relevance probabilities. The candidate budget determines which scores enter calibration. The mm and l2 boosts are retrieval-fusion weights. They do not change the fixed or custom criteria values used by native reranking, which evaluates the merged candidates afterward.

Query object parameters

Each object within the rescoring method array contains a query-type key directly, with an optional sibling boost. For example, use { "knn": { ... }, "boost": 0.3 }; do not wrap that entry in another query property. Place the entire hybrid expression under the request body’s top-level query.
A hybrid query requires exactly two query objects. If you need to express more complex logic within either object, use a boolean query to combine multiple conditions.

Boost constraints

  • The boost parameter is only available for mm and l2 rescoring methods.
  • Set boost on both query objects or omit it from both to use equal weights.
  • The sum of all boost values must equal 1.0.
  • Each individual boost value must be between 0 and 1.

Examples

Each JSON example below is a complete query request body. Field names must match your collection schema. The raw-vector examples use synthetic 64-dimensional vectors and assume fields configured with dimensions: 64; use your model’s full vectors, matching the configured dimensions, for real searches.

Bayesian hybrid query

This complete request searches the text and native embedding vector fields from the native embedding example:
Use exactly two unboosted subqueries. Bayesian fusion is top-level only: nested Bayesian, RRF, Min-Max, or L2 fusion is unsupported. Explicit boost, including 1, is rejected on either child and its Boolean descendants. Facets are unsupported with hybrid queries. The candidate budget controls retrieval and calibration depth for each signal; documents outside both retained lists cannot be recovered. With the same budget, query, filters, knn.k, and unchanged data, changing only size preserves the ranking prefix. Changing the candidate budget can change calibration and ranking. Scores are heuristic fusion scores, not relevance probabilities. Do not send top-level candidateSize with ordinary text/KNN or RRF/Min-Max/L2 requests. To rerank the Bayesian example, move the budget into rerank.candidateSize and specify the evaluation query and stored text fields:
Applied results expose the Bayesian score as retrievalScore and the final evaluation as score. See Native reranking for criteria and failure handling. Use the recommended releases in SDK usage, CLI queries, or MCP queries.

L2-norm hybrid query

This request combines text search with pre-filtered vector search using L2 normalization and weights of 0.7 and 0.3, then returns up to five documents.

MinMax hybrid query with sparse vector

This request combines sparse and dense vector search using Min-Max normalization and weights of 0.6 and 0.4, then returns up to ten documents.

RRF hybrid query

This example uses Reciprocal Rank Fusion to balance text and vector search results.
The final returned documents may not include the requested number of documents from the knn query. This is because the scores of documents returned solely from other queries may be higher than those of the top k documents returned from the knn.