Skip to content

Ridhi Dua

Hybrid Search for Ecommerce Product Discovery: How to Build and Test It

Shoppers type SKUs and sentences into the same box. Here is how to combine keyword and vector retrieval for a product catalog, merge the results, and test it before you ship.

A white and tan leather sneaker resting on two stacked stones against an orange paper backdrop, styled like a product catalog photo
Photo by Mojtaba Fahiminia on Unsplash
On this page
  1. What changes when the documents are products
  2. One shopper query, three behaviors
  3. Put filters inside the vector search
  4. Merging the two result lists
  5. Re-rank the short list with stock and margin
  6. Zero-result and long-tail queries
  7. How to test it before you ship
  8. Latency and cost
  9. Where to start: a decision guide
  10. Common questions about hybrid search for ecommerce
  11. Sources

Picture two shoppers at the same search box. One types a part number and wants exactly that product. The other types “lightweight rain jacket for hiking”, and the jacket that would suit them best may never use any of those words. Hybrid search for ecommerce product discovery is an attempt to serve them both: run keyword and vector retrieval on the same query, then merge the two ranked lists.

Put that way, it sounds like you simply get the best of both. So it may surprise you that when Vespa tried an untuned blend on Amazon product data, it saw no gain. What's going on? Published results show the gain depends on the catalog and the tuning, which means the interesting part is everything around the merge: what is specific to products, how to combine the two lists, and how to test the result before you ship it. (This is part of my Search & Discovery work. If you'd like the general comparison first, it's in hybrid vs keyword vs vector search.)

Short version

If you'd rather skip the reasoning, here's where we'll end up. Keep exact matching for SKUs, brands and part numbers, since those shoppers mean precisely what they type. Add vector retrieval for the descriptive queries. Apply price, size and stock filters inside the vector search. Merge by rank at first, move to tuned weights once you have judged queries to tune against, and finally re-rank a short list using stock and margin. Do hold every benchmark below a little loosely, though: none of them is a promise about your catalog.

What changes when the documents are products

So what actually changes when the documents are products? Look at a typical catalog title, something like “TR-410 Women's Trail Shoe, GORE-TEX, 2E Width”. It's short, it's structured and it's full of codes, which is a strange kind of text to search compared with a paragraph from an article. Now think about what people type to find it: anything from that exact string to “shoes that grip wet rock”. Hold those two ends in mind, ask what a search system would need to do for both, and four things (hopefully) start to feel inevitable.

›

Identifier queries need exact matching. SKUs, part numbers, model codes and brands are tokens (the exact strings a shopper types), not meanings, so there is nothing to “understand”. You might expect a vector search to cope anyway, but an InfoQ article on hybrid retrieval (June 2026) argues that embeddings, the lists of numbers that stand in for meaning, are weak at exact identifiers such as error codes and version numbers. Its examples are hand-built and none is a product code, so I'd read it as a description of the failure, not as evidence about catalogs. Keyword scoring isn't automatically right either: Vespa's 2019 e-commerce post notes that BM25 or TF-IDF (the classic word-counting scores) can rank “black mini ipad cover, compatible with ipad 2” above “Ipad 2” for the query “ipad 2”.

›

Descriptive queries need meaning. Here the shopper describes what they want, and the catalog uses other words. The same Vespa post sets “ladies pregnancy dress” against a listing titled “women maternity gown”, and cites a Flipkart study for the claim that a significant fraction of e-commerce queries suffer this vocabulary mismatch. It gives no figure from that study, so I wouldn't put a number on it.

›

Constraints are filters, not similarity. Price, size, colour and in-stock are yes or no questions. A vector search that treats “under $120” as a soft hint will happily return $160 products, because they are still close in meaning.

›

Business signals decide ties. Among products that match equally well, something has to set the order, and stock, margin and popularity are the usual candidates. Retrieval alone can't do that job.

One shopper query, three behaviors

Illustrative, not measured

The catalog, results and ranks below are invented to show the pattern. They were not measured on a real site.

Let's make that concrete with a query, “waterproof trail running shoes wide fit under $120”. In this made-up catalog, the best match is titled “TR-410 Trail Shoe, GORE-TEX, 2E Width” and costs $109. Watch what each approach does with it.

Keyword only

It matches the words, not the intent. The best product never says “waterproof” or “wide fit”, so it ranks low or is missed entirely. Meanwhile a waterproof shoe cover, whose title repeats “waterproof” and “shoes”, can rank first. And “under $120” is just text to it, so a $160 shoe still appears.

Vector only

It finds the GORE-TEX shoe, because the meaning is close, which is the point of using it. But the constraints turn soft: a $160 narrow shoe can rank third because it is semantically near.

Hybrid with filters

Here price up to $120 and width “wide” become filters applied inside the vector search, so every candidate meets them. The keyword side lifts titles that contain exact terms, the vector side adds the GORE-TEX shoe, and the merged list is then re-ranked for stock.

Now try a different query, “TR-410”. This time the keyword side finds the product and the vector side adds little. Which raises a question: should one blend serve both queries? Probably not, and that is why it has to be tuned by query type rather than set once.

One caveat about the example: it depends on catalog data. It only works if width and price are structured attributes (their own fields, not words buried in a description). If “wide” appears only in free text, there is nothing to filter on, and that is a data fix before it is a search fix.

Shoppers filter constantly, so the vector search has to respect filters without running short of results. You might think you can simply filter and then search, or search and then filter, but both have a catch. OpenSearch engineers describe the two obvious approaches and their limits: pre-filtering (filter first) uses exact search or builds a graph at query time, which is expensive and scales poorly, and post-filtering (search first) can return fewer than k results, where k is the number you asked for. Their efficient-filter method applies the filter during the nearest-neighbor search and lets the engine choose exact search when the filtered set is small. It arrived in OpenSearch 2.9 for the Faiss engine with HNSW and in 2.10 for IVF (two ways of indexing vectors for fast approximate lookup).

How fast is it? In their benchmark (1 million 128-dimension vectors, a synthetic attribute filter keeping 80% or 20% of documents, three r5.4xlarge data nodes), one-shard p50 latency (the median response time) was 17 ms and 27 ms, with recall@K of 0.998 and 1 (recall@K is the share of the true nearest neighbors that came back). That is not product data, so it shows the method works, not what your latency will be.

Vespa makes the same choice from an estimated filter hit ratio (the share of documents the filter keeps) and, by default, falls back to exact search when the ratio drops below 0.05. That post is from May 2022, so I'd check current defaults before relying on the number.

It's worth checking how selective your real filters are. A shopper who filters to size 14 within one brand may leave twenty products. At that size exact search is the better method, and these are the queries most likely to return few results, so I'd test them first.

Merging the two result lists

Once you have two ranked lists, you have to merge them, and the tempting move is to add the scores. That goes wrong because keyword and vector scores sit on different scales, so adding them raw lets one side dominate. Vespa's hybrid search guide says to normalize them (squash them onto a common range) or use reciprocal rank fusion (RRF), which ignores scores and uses only positions. That gives two families.

Rank-based: RRF

Merge by position: add 1/(k + rank) for each list, with k usually 60 (k just softens how much the very top ranks count). No normalization and no weights to tune. Vespa's guide says to start here. OpenSearch added RRF in 2.19.

Score-based: normalized weighting

Scale each score to a common range, then take a weighted sum, for example 0.6 text and 0.4 vector. You get more control, but you need judged queries (queries with human ratings of the results) to set the weights. OpenSearch has offered it since 2.10.

So which family wins? The honest answer is that it varies by dataset. The OpenSearch 2.10 benchmark covered seven datasets, including Amazon ESCI, a product search set. On ESCI, nDCG@10 (a score for how well the top ten results are ordered) was 0.081 for BM25 and 0.088 for the hybrid query. The post's average gain over BM25 was 8.12%, and it warns that hybrid may not improve results on every dataset.

The RRF numbers are less flattering than you might expect. In the RRF benchmark on six BEIR datasets (public test collections; none is a product catalog), RRF scored on average 3.86% lower in NDCG@10 than min-max hybrid, with latency within a few percent either way. The authors still describe the quality impact as minimal. The z-score normalization post shows how fragile a ranking can be: z-score (a different way to rescale scores) beat min-max by 2.08% on average in development tests on five datasets, then trailed it by 0.53% in a 12-shard production-style test, where the authors judged min-max more reliable.

A cautionary result

It's tempting to read all this as proof that hybrid just works, so here is a result that pushes the other way. Vespa tested a 50/50 blend of a MiniLM embedding (a small, general-purpose embedding model) and its nativeRank text score on Amazon shopping queries and saw no improvement over lexical ranking alone. The blend weight was not tuned, the off-the-shelf model scored below the lexical methods, and only labeled products were re-ranked. I'd take it as a warning that the embedding model and the weights decide the result. It does not show that hybrid fails.

Tuning is where product data pays back. In an ESCI experiment by an OpenSource Connections consultant, a 66-configuration sweep (two normalizers, three combiners, eleven weight splits) lifted NDCG@10 from 0.24 to 0.26 on a 250-query sample and from 0.23 to 0.25 on a 5,000-query sample, both on held-out test queries (queries not used for tuning). Predicting the weight per query raised DCG@10 further, from 9.99 to 10.92 and from 9.30 to 10.13. The gains did not hold for every query, only about 35% of the top-10 results had judgments, and the author advises evaluating on your own data.

My starting point, and this is my view rather than a finding, is RRF until you have judged queries, then weights. Vespa's guide suggests short queries may deserve more text weight and longer ones more vector weight, which fits the identifier and descriptive split above. I'd also tune the keyword query first, as the OpenSearch author advises, because it is half of the hybrid query.

Re-rank the short list with stock and margin

Retrieval decides which products are candidates. Ranking sets their order, and that is where stock, margin and popularity belong. You might wonder whether a model can learn that balance for you. Vespa's learning-to-rank series names margin, price and popularity as business features for a tree-based ranker (a model built from many small decision trees) and describes e-commerce ranking as a balance between relevance and revenue. Its own experiment used text features and optimized relevance only, and found the tree models' gain over the bi-encoder (an embedding model that encodes the query and the product separately) insignificant. It did not test margin or revenue, so it shows the mechanism, not the payoff.

InfoQ's May 2026 report on Swiggy shows what this looks like in production: candidates come from lexical retrieval plus embedding similarity, then a learned ranker inside OpenSearch uses clicks, item popularity and other real-time signals, with lightweight models preferred to protect latency. That system ranks autocomplete suggestions, not product results, and the report gives no figures, so it is a shape to borrow, not a result to expect.

How deep should the re-ranker go? That is a cost decision. In Vespa's trace a cross-encoder (a model that reads the query and a product together) costs about 1,500 times as much as fieldMatch, a built-in text-matching feature, while a tree model of 300 to 500 trees takes roughly 1 to 3 microseconds per document. The InfoQ hybrid retrieval article re-ranks only the top 20 to 50 fused candidates and puts a 50-candidate pass on a GPU at typically under 100 ms. My contract-search case study, built on a public dataset rather than a client catalog, uses the same retrieve-then-rerank shape, and its engineering note records how latency grows when the reranker is called once per sentence.

As for stock and margin, I'd treat them as bounded adjustments after relevance, not as the sort key. That is my view rather than something the sources tested. A low-margin exact match should still beat a high-margin loose match, so let margin break ties between close scores only. Out-of-stock items belong in a filter or a heavy demotion, never at position one.

Zero-result and long-tail queries

Vocabulary mismatch is one cause of zero-result searches, and the vector side addresses it. My zero-result playbook sorts the causes into four and covers the rest. Two cautions apply to hybrid, though.

First, a vector search always returns neighbors, so a query for something you don't sell returns near-misses instead of an honest empty page. A minimum similarity or score cutoff helps, and the OpenSearch 2.10 post listed a minimum-score option as planned work, so check what your version offers. Second, track judged relevance on tail queries (the rare, one-off searches) as well as the zero-result rate, because that rate can fall while results get worse.

How to test it before you ship

1

Build the query set

Sample real queries and tag each as identifier, descriptive or attribute-heavy. Vespa's ESCI test averaged over unique queries with no frequency weighting, so it could not show head-query (most frequent) effects. Weight yours by how often shoppers search.

2

Judge the results

Grade the top results for each query. The OpenSearch ESCI author suggests rating about twice the depth of your default results page. If you use an LLM to label at scale, check a sample against people: InfoQ's report on DoorDash describes about 700,000 human-labeled query-product pairs expanded to roughly 32 million with a GPT-based labeler, and gives no evidence of how well that held up.

3

Fix the baseline first

Tune the keyword query before adding vectors, so you measure what vectors add and not what your keyword query was missing.

4

Compare offline

Report NDCG@10 and precision@10 (the share of the top ten that are relevant) by query type against the tuned keyword baseline, then sweep the fusion settings. Read the per-query wins and losses, not only the averages. Keep a must-win list of SKU and brand queries that may not regress.

5

Test online

Run an A/B test (two live versions compared on real traffic) on search conversion, revenue per search, refinement rate and latency. None of the sources above reports an online test with numbers, so your own test is the real answer.

Latency and cost

Hybrid runs two retrievals and a merge, so it is fair to expect it to cost more. In the OpenSearch 2.10 benchmark, server-side latency for the hybrid query was 6.4% higher at p50, 7.0% at p90 and 8.3% at p99 than a Boolean query (three r5.8xlarge data nodes, seven datasets), and the authors expected later versions to reduce it. (p50, p90 and p99 are the response times that 50%, 90% and 99% of queries beat.) Embedding each query adds inference time on top, so measure end to end.

The same post found the best relevance with a size or k of 100 to 200, and larger values added latency without helping. The index also carries vectors as well as text, and the re-ranker adds a per-query cost. I'd set a p95 target before running the experiment, so the offline winner is one you can afford.

Where to start: a decision guide

Mostly SKU and brand queries

Keep keyword search. Fix synonyms and attributes, and revisit hybrid when descriptive queries show weak results.

Descriptive queries, no judged set

Start with RRF (merging by rank) and build a judged query set from your search logs.

A few hundred judged queries

Move to weighted fusion and test separate weights for short and long queries.

Size, fit or compatibility filters

Use filtered vector search, and check how selective your filters are before you trust the latency.

Stock and margin signals

Add a re-ranking stage after fusion, with bounded adjustments and a depth you can afford.

If you run OpenSearch or Elasticsearch, hybrid queries are already part of the engine. The OpenSearch consulting page covers the implementation side, and search for online stores and marketplaces covers the catalog side. For the semantic half on its own, see what semantic search means.

Common questions about hybrid search for ecommerce

Does hybrid search improve ecommerce product search?

Often, but not on every dataset. On Amazon ESCI, OpenSearch measured nDCG@10 of 0.088 for the hybrid query against 0.081 for BM25, while Vespa saw no gain from an untuned blend of a general embedding model with its text score. So it's worth measuring on your own queries before you commit.

Should I use RRF or weighted scores?

Start with RRF, since it needs no normalization or weights. Move to normalized weights once you have judged queries and want finer control, as Vespa's guide suggests. In OpenSearch's benchmark RRF scored 3.86% lower in NDCG@10 than min-max hybrid on average, so it's worth testing both.

How do SKU and part-number searches work in a hybrid setup?

The keyword side matches them exactly. In my view it's worth keeping identifier fields in the keyword query with their own boost, and putting identifier-shaped queries in your must-win test set, so a vector-heavy blend can't push the exact product down.

Do I need to replace Elasticsearch or OpenSearch?

No. OpenSearch has supported hybrid queries since 2.10, and the InfoQ article points to the retriever APIs in Elasticsearch and OpenSearch for in-engine fusion. It's worth checking the version you run, because processor options have changed across releases.

How many queries do I need to judge?

A few hundred is a reasonable place to start, though that is my rule of thumb, not a published threshold. The OpenSearch ESCI experiment used samples of 250 and 5,000 queries. Cover each query type, and treat small differences as noise until a larger set or an A/B test confirms them.

Does hybrid search fix zero-result searches?

Partly: it removes the ones caused by wording mismatch. It does not fix products you don't stock, and a vector search can replace an empty page with weak matches. The zero-result playbook covers the full set of causes.

Sources

Dates are as shown on each page, read in November 2026. The OpenSearch pages show only a last-updated date, so their original publication dates are not confirmed here. They describe OpenSearch 2.10, 2.19 and 3.0-beta1, and later 3.x releases may have changed processor options, so check the current documentation before copying a configuration. The Vespa posts from 2019 and 2022 predate its current documentation.

OpenSearch blog, updated 2025-06-18

Improve search relevance with hybrid search, generally available in OpenSearch 2.10. Gaievski, Verma, Nakkirtha and Kolchina. Supports the seven-dataset benchmark including Amazon ESCI, the 8.12% average gain over BM25, the hybrid latency overhead and the size and k advice.

OpenSearch blog, updated 2025-06-18

Optimizing hybrid search in OpenSearch. Daniel Wrigley, OpenSource Connections. Supports the 66-configuration ESCI sweep, the NDCG@10 and DCG@10 figures, the 35% judgment coverage and the per-query variance.

OpenSearch blog, updated 2025-11-11

Introducing reciprocal rank fusion for hybrid search. Bogan, Gaievski, Shah and Kolchina. Supports RRF in OpenSearch 2.19 and the six-dataset BEIR comparison.

OpenSearch blog, updated 2025-06-18

Z-score normalization technique for hybrid search. Shah, Gaievski, Kazi and Kolchina. Supports the development and production benchmark figures for z-score against min-max (OpenSearch 3.0-beta1).

OpenSearch blog, updated 2025-06-18

Efficient filtering in OpenSearch vector engine. Verma and Nakkirtha. Supports the pre-filter and post-filter limits, the efficient-filter method, its versions and the latency and recall figures.

Vespa blog, 29 Nov 2019

E-commerce search and recommendation with Vespa.ai. Jo Kristian Bergum. Supports the vocabulary mismatch example and the BM25 ranking example.

Vespa blog, 20 May 2022

Query Time Constrained Approximate Nearest Neighbor Search. Geir Storli and Jo Kristian Bergum. Supports the hit-ratio choice between filtering strategies and the 0.05 exact-search threshold.

Vespa blog, 3 Nov 2022

Improving Product Search with Learning to Rank, part one. Jo Kristian Bergum. Supports the untuned 50/50 hybrid result on Amazon shopping queries and the unweighted-query caveat.

Vespa blog, 1 Dec 2022

Improving Product Search with Learning to Rank, part three. Jo Kristian Bergum. Supports the business features, the relevance and revenue balance, the insignificant gain and the re-ranking cost figures.

Vespa Learn, undated (copyright 2026)

Hybrid search. Vespa documentation course. Supports the fusion options, the advice to start with RRF and the query-length weighting guidance.

InfoQ, 2 Jun 2026

Why Vector Search Alone Isn’t Enough: Hybrid Retrieval for RAG. Aaditya Chauhan. Supports the identifier weakness of embeddings, the re-ranking depth and latency, and the retriever APIs.

InfoQ, 18 May 2026

Swiggy Improves Search Autocomplete Using Real Time Machine Learning Ranking. Leela Kumili. Supports the two-stage candidate and ranking design with real-time signals inside OpenSearch.

InfoQ, 16 Mar 2026

DoorDash Builds DashCLIP to Align Images, Text, and Queries for Semantic Search Using 32M Labels. Leela Kumili. Supports the human-labeled and GPT-expanded label counts.

Want hybrid search tested on your own catalog?

Book a consultation