Design Amazon Search Ranking

Free with account Updated Nov 16, 2026 · 19 min read
On this page

    Problem Description

    In this interview, we're going to design the ranking behind an online store's search box, similar to product search on Amazon or Etsy. A shopper types what they are looking for, such as "running shoes for wide feet", and can narrow it down with filters such as size, brand or price. The system decides which of the store's products to show and in what order, so the ones the shopper is most likely to buy come first, even when the shopper describes a product in different words than its seller did; only products in stock and matching the filters appear, and more come as the shopper scrolls. Shoppers click on products, add them to their cart and buy them, and the system keeps learning from what they do. Sellers add new products all day, and those should be found too. You can use existing building blocks: a catalogue service that stores every product with its current price and stock and announces every change, and a search index such as Elasticsearch that finds products containing the words of a query. This interview is about choosing and ordering products, not about the product pages or checkout.

    Out of Scope

    • Sponsored products – placed by the ads system in slots we leave for it.
    • Spelling correction and suggestions while typing – their own systems; we receive the query as the shopper sent it.
    • Personalizing heavily by each shopper's history – a light preference signal is enough here; a good follow-up question.
    • Product pages, cart and checkout – the store already has them.
    • Searching in many languages – one language to start.

    Good Clarifying Questions

    1. How many products and searches? – About 300 million products and 300 million searches a day, about 10,000 a second at the evening peak.
    2. What does success mean for the business? – More searches that end in a purchase. Shoppers retyping their search, or the store earning less per search, are warning signs.
    3. How fast must results appear? – The first page within 200 ms at p99, of which about 80 ms can go to ranking. Later pages within 100 ms.
    4. How fresh must it be? – A price or stock change shows within a minute. A new product can be found within an hour. The ranking model is retrained at least daily.
    5. What if ranking fails? – Results must still come back, even in a simpler order. An empty page because a model is down is not acceptable.

    Requirements

    Functional Requirements

    1. Search for Products – Shoppers can type a query and add filters; the results show products in stock that match the filters, the ones they are most likely to buy first, and more as they scroll.
    2. Record What Shoppers Do – The system records which products each shopper was shown for each search, at which position, and whether they clicked, added to cart or bought.
    3. Keep Learning – The system trains a new ranking model from these records at least daily and uses it only after it proves at least as good as the current one.

    Non-Functional Requirements

    1. Scale – 300M searches a day: about 3,500/s on average, 10,000/s at peak, over 300M products; a query can match tens of thousands.
    2. Latency – First page under 200 ms at p99, with about 80 ms for ranking; later pages under 100 ms.
    3. Freshness – Price and stock changes within 1 minute; a new product findable within 1 hour; a new model at least daily.
    4. Availability – 99.9%. If ranking or the feature store is down, results still come back in a simpler order; never an empty page.