200k/s
searches when a big sale opens at midnight
Ten times a normal day, within minutes. The 250 GB index would fit one large server; CPU per query at peak forces 250 nodes.
What is one document?
Bad: Per product, with arrays
Arrays forget pairs: “red, size 9” finds a shoe nobody can buy.
Good: Per visual variant
One per colour, sizes in stock inside; collapse to one card per shoe.
Only “running shoes” is left to match as text
Fix “runing” from query logs. Extract red and under 2000. Predict the category. Precise constraints become filters; noisy ones like colour become boosts.
50 million documents in, 40 cards out
Each stage is pricier per document and sees fewer. Learning to rank re-scores only the top 1,000; business rules touch only the final page.
Sale peak: 50,000 price changes a second. Each index write rewrites a whole document, on 25 copies.
The trick
Cards read exact prices from a live store. The index gets only changes that flip a filter.
Delivery by tomorrow to 560001? Index warehouses, not pincodes
Pincodes per SKU: 250 billion postings. Instead, each pod holds a 600 KB map from pincode to warehouses, and the index filters on stock_wh.
Past the plan? Step down, don’t fall over
- Rescore the top 300, not 1,000
- Serve facets from cache only
- Cap pages at 20
- Shed scrapers and bots first, then deep pages
Remember
One document per visual variant. Parse the query into filters, rank in stages, read exact price and stock from a live store, and pre-scale for sale day.