Commerce & payments · Intermediate
Product catalog & search
Document-store catalog, a change-stream-fed search index, and a retrieve-then-rank search funnel.
Every part, and why it is there
Shoppers
People type messy queries like “red runing shoes size 10” and expect relevant results in a blink, then open product pages.
CDN
Product images are most of the bytes on a storefront. Serving them from the edge keeps pages fast and origin traffic small.
Product images
Original and resized images. Cheap, durable, and only ever read through the CDN.
API gateway
Single entry point for the storefront’s API calls; handles auth, routing and throttling.
Storefront BFF
A backend-for-frontend that assembles a search results page or product page from several services in one round trip.
Search service
Runs the search funnel: understand the query, retrieve a few thousand matches cheaply, then rank the top few hundred carefully.
Query understanding
Fixes typos, expands synonyms and spots intent (“size 10” is a filter, “red” is a colour). Better queries improve results more than a bigger index.
Search index (Lucene shards)
An inverted index of product text plus filterable fields like brand, price and stock. Sharded so each query fans out in parallel.
Ranking model
Re-orders the retrieved products using signals like past clicks and purchases. Only applied to the top candidates because it is far more expensive than retrieval.
Product service
Owns product data: titles, attributes, variants, price. Every edit is saved here first, then announced.
Product cache
Product pages are read thousands of times per edit. A cache in front of the catalog keeps page loads fast.
Catalog (document DB)
Products have wildly different attributes (a TV vs a T-shirt), which fits a flexible document model better than one wide relational table.
Catalog changes
Every product edit and stock change is published here. The index is built from this feed, so search never queries the catalog live.
Index builder
Turns each changed product into a search document and writes it to the index within seconds. A full rebuild replays the feed into a fresh index and swaps it in.
Asked in interviews at
- meta
- amazon
- ebay
Learn more
- Elasticsearch Deep Dive w/ a Ex-Meta Senior Manager for System Design Interviews (Hello Interview)
- Anatomy of an E-commerce search Engine (TechJam)
- Building world-class product search (Shopify Engineering)
- From structured search to learning-to-rank-and-retrieve (Amazon Science)
- Elasticsearch deep dive (Hello Interview)