Design a Property Search Service
- Scope a home search service by city, ZIP code and map area before drawing anything
- Split the listing store from a geo search index and keep the two in sync
- Go deep on map-box queries, filters, listing freshness and the systems Zillow already has
Understanding the problem
Something like this. Design a home search service where people find homes for sale or rent by typing a city or ZIP code, or by moving a map, then narrow the results with filters and open a listing. The service has to fit into the rest of Zillow's products.
No other Zillow system design prompt has as many firsthand reports. In a March 2026 onsite in Mexico City, a senior engineer drew a property search engine on a whiteboard, and it also had to relate to the company's ecosystem. A principal candidate in a 2023 US loop had one design round about finding properties by location or city. A big-data engineer in November 2025 got a vaguer version: a system based on your location. There's an older cousin too. In a 2021 senior front-end loop, the hiring manager round asked the candidate to design a Zillow app.
The product is one you've almost certainly used. You open the map, drag it over a neighborhood, set a price ceiling and a bedroom count, and pins appear. Every drag is a new search. Behind it sit millions of listings that change all day: price cuts, new photos, a home going pending, a rental getting leased. So the round has two halves that pull against each other. Reads are heavy and need to feel instant. Writes are lighter, but users notice fast when a sold home still shows as for sale. Most of the hour goes on how the search index answers a map box quickly and how it stays close to the truth.
Requirements
Functional requirements
Zillow's prep material says to agree on requirements with your interviewer before moving forward, and to imagine using the feature yourself. So walk through a session out loud. A buyer types "Austin" and sees homes in that city. Zooming into one neighborhood, the results follow the map. Next come filters: under $600,000, three bedrooms, houses only. Then they sort by newest, page through results and open one home to see its photos and details. That gives a short list. Search by a named place, search by the visible map area, filter and sort, page through results, and see listing details. Listings also have to get in: new homes, price changes and status changes arrive from listing sources all day.
In scope
- Search by a place name: a city, ZIP code or neighborhood
- Search by the area visible on the map, refreshed as the user pans and zooms
- Filter by price, beds, baths, home type and for sale or for rent
- Sort and page through results, and open one listing's details
- Take in new and changed listings and reflect them in search quickly
Below the line (call it out, then skip)
- Photo storage and image delivery, beyond a URL on each listing
- Ranking with machine learning or personalized results
- Free-text search over listing descriptions
- How home value estimates are computed
Non-functional requirements
Ask for numbers. If the interviewer has none, propose round ones and say they're assumptions: about 3 million active listings for sale and for rent, and 20,000 searches a second at the evening peak. That peak is high because a single map session fires many searches as the user pans. Latency is the first target. A map that lags behind the user's finger feels broken, so aim for search answers in about 200 milliseconds on the server. Listing details can be a little slower. Freshness is the second. If each active listing changes about once a day, that's 3 million changes a day, roughly 35 a second on average, with bursts when large feeds sync. Search can be eventually consistent. A new photo can take a few minutes to show up. A home that went pending or sold should drop out of results within about a minute, because that's the stale result that wastes a buyer's Saturday. Reads outnumber writes by several hundred to one at peak, and availability beats perfect consistency. A search that returns slightly old results is far better than a search page that errors.
- Active listings: about 3 million. An assumption to check out loud. At about 2 KB of searchable fields each, the whole index is around 6 GB.
- Peak searches: 20,000 a second. Every pan and zoom is a search, so the read rate is far above the number of people searching.
- Listing changes: about 35 a second. 3 million changes a day divided by 86,400 seconds, with feed syncs arriving in bursts well above that.
- Freshness target: about a minute. For status changes like pending or sold. Photo and description edits can lag a few minutes.
The set-up
Core entities
Property
The physical home: its address, its location as latitude and longitude, and facts that rarely change, like lot size and year built. It exists whether or not it's on the market, which is why it sits apart from the listing.
Listing
One offer to sell or rent a property. It holds the price, beds, baths, home type, status (active, then pending, then sold or leased, or withdrawn) and photos. A listing points at its property and carries a version that goes up with every change.
Region
A named shape such as a city, ZIP code or neighborhood, stored as a boundary polygon. It turns "Austin" into an area to search.
Search request
What the user is asking for right now: an area (a map box or a region), the filters, a sort order and a page cursor. It isn't stored, unless the user saves it as a saved search.
Say the property and listing split out loud, because it's the first place the ecosystem shows up. Over the years one house gets listed for sale, sold, listed for rent and sold again. Saved homes, value estimates and sale history all hang off the property. Search, though, only cares about active listings.
The source of truth is Postgres, with listings keyed by listing_id. At 3 million active rows plus history, one primary with read replicas handles it easily. The search index is a separate copy of the searchable fields, rebuilt from the database whenever needed.
| Table | Fields |
|---|---|
| properties (Postgres) | property_id · address · latitude · longitude · lot_size · year_built |
| listings (Postgres) | listing_id · property_id · source · status · price · beds · baths · home_type · version · updated_at |
| regions (Postgres with PostGIS) | region_id · name · kind · boundary |
| search index document | listing_id · location · price · beds · baths · home_type · status · listed_at · version |
API
Search is one endpoint that takes either a map box or a region, because the product moves between the two all the time. Typing "Austin" searches a region, and the first drag of the map turns it into a box search.
High-level design
The design splits into a write side, which takes listings in and keeps the truth, and a read side, which answers searches from a copy built for searching. A change stream connects them. In the diagram, blue is outside this service (apps, listing sources and Zillow systems we assume exist), violet is a service we run, amber moves events, and green stores data.
1) A listing comes in. A feed sends a price cut for a home in Austin. The Ingestion service maps the record to our fields and matches it to its property. Then it writes the new price, bumps the listing's version, and adds an outbox row, all in one Postgres transaction in the Listing store. That takes a few milliseconds, and nothing on this path touches the search index. Writing to two systems in one request is how they drift apart, so the next step owns the index. How fast the change reaches search is the freshness deep dive.
2) The change spreads. A relay publishes the outbox row to the Listing change stream, keyed by listing id. The Indexer reads it, batches it with other changes from the last second, and sends the new price to the Search index with its version. Within a second or two, a search sees the new price, and the alerts side of Existing Zillow systems reads the same event to tell people who saved this home about the price cut. A queue would hand each event to one reader. A log lets every reader see every event, which is why this is a log.
3) Someone searches a city. A buyer types "Austin". The Search API looks up the city's boundary in Region shapes and queries the index for active listings inside it that match the filters. It returns the first 40 cards, the pins for the visible area, a total count and a cursor. A city can hold tens of thousands of listings, and sending all of them to a phone is pointless. What to return when the area is huge is part of the map-search deep dive.
4) Someone drags the map. The app waits until the drag pauses, then sends the visible box as bounds with the same filters. The Search API checks the Result cache for a busy tile, and on a miss runs one geo-box-plus-filters query against the index. At 20,000 searches a second this is the hot path, and its speed depends entirely on how the index finds homes inside a box. That's the first deep dive. When the buyer opens a home, the Listing service serves the full record from the listing store.
Technology choices
- The Listing store is Postgres. Listings are structured records with relationships to properties, and ingestion needs a transaction that writes the listing, its version and its outbox row together. Run a primary with a synchronous replica, meaning a write isn't confirmed until a second machine has it, so failover loses nothing. Add read replicas for the listing pages.
- The Search index is Elasticsearch or OpenSearch. It's built for queries that mix a geo shape, several filters and a sort, answered from in-memory structures. If a node dies, a replica copy on another node keeps serving, and the cluster copies data back onto a replacement on its own. It's a copy of Postgres, so the worst case is a rebuild.
- The Listing change stream is Kafka. A topic is split into partitions, and events with the same key always land in the same partition, in order. Keying by listing id keeps each listing's changes ordered. Each reader tracks its own position, called an offset, so a crashed indexer restarts from where it stopped.
- The Result cache is Redis with a short expiry. If it goes down, every request falls through to the index, which is sized to carry the full load anyway. The cache only trims cost and latency on busy areas.
- Region shapes live in Postgres with PostGIS, the spatial extension that stores polygons and answers "which shapes contain this point". They're read rarely and cached in the Search API, so the database is never on the hot path.
- The Search API, Indexer and Ingestion service are stateless services on Kubernetes. The indexer scales with how far it lags behind the stream, and the Search API scales with request rate.
If the interviewer's team uses different tools, keep the categories and swap the names. What matters is the shape: a relational store for the truth, a search engine for the reads, and a log between them.
Potential deep dives
Zillow's prep video says that near the end of the interview, the interviewer will ask you to choose an area to explore further. Have two ready. Map search and freshness are the strongest picks for this design, and the ecosystem question is the one the 2026 report names.
How do we find every home inside a map box quickly?
A map box is two ranges at once: latitude between south and north, and longitude between west and east. Ordinary database indexes sort on one value, so they can only narrow one of the two ranges. A box over one Austin neighborhood is about 3 km tall. Every home in the country inside that 3 km latitude band matches the first range, from West Texas to Florida.
Approach
Put a B-tree index on latitude and another on longitude in the listings table, then query with a range on each.
Challenges
The database can use only one index well per range. Say it picks latitude: it reads every listing in that coast-to-coast band, then checks each one's longitude. With 3 million listings, a thin band can still hold tens of thousands of rows, so each map drag scans far more data than it returns. At 20,000 searches a second, the primary falls over. Be ready to explain why this fails even though it looks reasonable.
Approach
Give each listing a cell id. A geohash cuts the world into a grid and names each cell with a short string, where a longer string means a smaller cell. At 6 characters a cell is about 1.2 km by 0.6 km. Index listings by cell. A query works out the cells that cover the box, about 15 to 20 for a neighborhood, fetches the listings in those cells, then drops the few outside the exact box. In Postgres, PostGIS does the same job with an R-tree, a tree of nested rectangles.
Challenges
Geo lookups are now fast. The trouble is everything else in the query: price, beds, home type, sort by newest, a total count, and page two. A relational database does those as extra work on top of the geo lookup, and doing it 20,000 times a second means many replicas tuned for one query shape. Cells also vary wildly in density. A Manhattan cell can hold hundreds of listings while a rural one holds none.
The cell idea is what every geo index does underneath, and the coding problem at the end of this lesson builds a small one. What pushes the design past the Good tier is the rest of the query. A search here is never "homes in this box". It's "active three-bedroom houses under $600,000 in this box, newest first, with a count".
Approach
Store each active listing in Elasticsearch with its location as a geo point. The engine keeps a geo index (a tree over the coordinates) next to compact indexes for each filter field. It finds the homes inside the box, keeps those that match every filter, and sorts them, in one pass over in-memory data. A region search sends the city's bounding box plus its polygon, and the engine trims homes outside the actual boundary.
Challenges
The index is now a second copy of the data, so it can be out of date. That's the freshness dive. It's also more to run: a cluster, its memory, and its upgrades. At about 6 GB the whole index fits in one shard. Keep it as one shard with many replicas, so every search is answered by a single node instead of being fanned out and merged across many.
Zoomed out, the problem changes shape. A box over all of Texas might match 100,000 active listings, and no phone can draw that many pins. Past a pin limit of around 500, the Search API asks the index for counts per cell instead, a feature Elasticsearch calls a geohash grid aggregation. The map shows clusters labeled "1.2k", and the list shows the first page of homes sorted as asked. As the user zooms in, the clusters turn back into pins. The location-based services lesson compares geohash, quadtrees and R-trees in general. For this prompt, defend the cell idea once and then lean on the search engine.
How do filters, sorting and paging stay fast as the map moves?
Each map move is a fresh query with up to a dozen filters, a sort, a count and a page. A search engine handles the filters well, but four parts of the request get expensive in ways that aren't obvious.
Filters that only include or exclude go in filter context
Price, beds, home type and status don't affect relevance. They just include or exclude a home. Elasticsearch caches the result of those clauses as a compact set of matching documents, so the next search with "active, 3+ beds" reuses it. Sort by price, date or size, never by a computed relevance score you don't need.
Page with a cursor, never an offset
Asking for page 50 with an offset makes the engine sort and throw away 2,000 results first. Instead, return a cursor holding the last result's sort values, such as price and listing id. The next page asks for everything after that, so every page costs the same. The listing id breaks ties, so a page never repeats or skips a home.
Counts can be approximate past a limit
"Showing 40 of 12,384 homes" doesn't need to be exact. Count exactly up to 10,000 and say "10,000+" beyond that, which stops the engine from walking every match on a huge zoomed-out box.
Snap the box so busy areas cache
Two people looking at downtown Seattle never send exactly the same box. Snap each box to the map tiles it covers at that zoom and cache results per tile and filter set for about 30 seconds. Default filters on popular metros hit the cache. Anything unusual goes to the index.
The app's behavior matters as much as the server's. Without a pause before calling, one long drag can fire dozens of requests, and every one but the last is wasted. Waiting for about 300 milliseconds of stillness, and cancelling in-flight requests when the map moves again, can cut search traffic several times over. The scaling reads playbook covers caching and replicas more generally.
How fresh are results after a price cut or a sale?
A buyer who taps a home and finds it sold yesterday loses trust in the whole map. The target from the requirements is about a minute for status changes. Normal load is only around 35 changes a second, but a large feed can dump hundreds of thousands of changes in a few minutes. The pipeline has to absorb that burst without the index falling behind by an hour.
Approach
Export all active listings from Postgres once a night and build a fresh search index from them.
Challenges
Simple, and every change shows up the next day. A home that sells at 9 a.m. keeps appearing in searches until tomorrow, and price cuts sit invisible all day. A full rebuild is still worth having for a different job, which is recovery. It just can't be how changes arrive.
Approach
When ingestion saves a listing, it also sends the update to the search index before returning. Changes show up in about a second, with no extra pipeline.
Challenges
It's a dual write, two systems updated one after the other with nothing tying them together. If the process crashes between the two writes, or the index is down for a minute, Postgres has the change and the index never gets it. Nobody notices until a sold home keeps showing. Ingestion also slows to the speed of the index, so a feed burst backs up into the feeds.
Approach
Ingestion writes the listing and an outbox row in one transaction, so the listing row and its event are saved together or not at all. A relay publishes outbox rows to Kafka, keyed by listing id. The indexer reads them, batches a second's worth, and writes them in bulk with each listing's version as an external version. Elasticsearch rejects an update whose version isn't higher than the one it holds, so a late retry of an old change can't undo a newer one.
Challenges
Freshness is now a lag you have to watch: time from commit to visible in search. Alert if it passes a minute. During a feed burst the indexer falls behind, so scale its workers with lag and let sold and pending changes skip ahead in a separate high-priority topic. Something will still drift eventually, so run a nightly job that compares versions per region and re-sends any mismatches.
One catch with deleting sold homes: Elasticsearch only remembers a deleted document's version for about 60 seconds by default, so a retry later than that could bring the home back. Either raise that window or keep sold homes in the index marked inactive and filter them out. The rebuild from the Bad tier comes back as a safety net. To change the index layout, or recover from a bug, build a new index from Postgres alongside the old one. Replay the change stream from the moment the build started. Then switch the alias, a name the Search API queries that can point at either index. At 5,000 documents a second, 3 million listings rebuild in about 10 minutes, with no downtime.
index holds listing 812 price 615000 version 7event listing 812 price 599000 version 8 -> appliedlate retry listing 812 price 615000 version 7 -> rejected, 7 < 8event listing 812 status sold version 9 -> removed from searchWhich existing systems do we assume, and how does search fit Zillow?
The 2026 report put this inside the prompt itself: the search engine also needs to relate to the company's ecosystem. Draw search as one service among several. Say what it owns and what it leaves to others. Search owns the index, the query path and the freshness pipeline. It doesn't own accounts, saved homes, touring, agents, loans or value estimates. For each one, say how search connects to it.
| System we assume exists | How search connects |
|---|---|
| Accounts and sign-in | The Search API reads the signed-in user from the request to mark saved homes on the results. Search works signed out too. |
| Saved homes and saved searches | A saved search is a stored search request. The app sends it back to the same search endpoint when the user opens it. |
| Alerts (email and push) | Reads the listing change stream. A new listing or price cut is checked against saved searches to decide who to notify. |
| Home value estimates | Shown on the detail page by the listing service at read time. Copied into the index in a daily batch only if users filter or sort on it. |
| Touring and agent contact | Linked from the listing page by listing id. Search only needs to drop a home once it is pending or sold. |
| Other front ends | Zillow Group runs several brands, Trulia, StreetEasy and HotPads among them. Ask whether one search service should serve more than one app. |
Alerts run search in reverse. Normal search takes one query and finds many listings. An alert takes one new listing and has to find every saved search it matches. Running every saved search again after each change doesn't scale. Two approaches work. The first is to index the saved searches themselves by geo cell, then check a new listing only against searches whose area covers its cell, then check their filters. The second is the search engine's own reverse search, which Elasticsearch calls a percolator. Either way, alerts read the same change stream as the indexer, which is why the diagram has two readers on one log.
What happens when the evening peak hits, or a part fails?
Run the read math. If one Elasticsearch node answers about 1,000 of these geo-plus-filter queries a second, 20,000 a second needs about 20 nodes, plus headroom for a lost node and for traffic spikes, so call it 25 or 30. Since the whole index is about 6 GB and lives in one shard, each node holds a full copy and answers a search alone. Adding capacity means adding replicas. Splitting into more shards would make each search wait for every shard and merge their results, which only helps once the data stops fitting on one machine. Spread the replicas across availability zones, which are separate data centers in one cloud region. Deploy a second full cluster in another region if the interviewer wants regional failover. Each region's indexer reads the same Kafka topic, so both stay current.
Then degrade in order. If the index is slow, drop the expensive extras first: exact counts become "10,000+", cluster counts get coarser, and the cache expiry stretches from 30 seconds to a few minutes. When the indexer falls behind, searches still work on slightly old data, and the lag alert fires. With Postgres down, ingestion stops and the detail pages fall back to cache, but search keeps answering from the index. Each part can fail without taking search down, and that's the property worth saying out loud. Track search latency at the 99th percentile, indexer lag, rejected stale versions and cache hit rate.
Practice the core in code
This problem shrinks two ideas from the design into one class. It's a grid of cells that answers a map box by looking only at the cells the box covers. And it checks versions, so a late update can never overwrite a newer one or bring a sold home back. Coordinates are whole numbers to keep the arithmetic exact. Think of them as latitude and longitude multiplied up.
Map search over a versioned listing index
Problem
Write a class
ListingIndex built with a cell_size. Coordinates are integers. A listing at (latitude, longitude) belongs to the cell (latitude // cell_size, longitude // cell_size), using floor division.upsert(listing_id, latitude, longitude, price, beds, version) adds the listing or replaces it, possibly at a new location, and returns true. If a version greater than or equal to version has already been seen for that id, by an upsert or a remove, it changes nothing and returns false.remove(listing_id, version) takes a listing off the market. If a version greater than or equal to version was already seen for that id, it changes nothing and returns false. Otherwise it records version as the newest seen, removes the listing if it is active, and returns true only if a listing was removed.search(south, west, north, east, max_price, min_beds, limit) returns the ids of active listings with south <= latitude <= north, west <= longitude <= east, price <= max_price and beds >= min_beds. Sort them by price, then by id, both ascending, and return at most limit ids. Only look inside cells that overlap the box.Input encoding. A test case is a JSON array of operations. The first entry is
["ListingIndex", [cell_size]] and each later entry is [method, [args]]. The expected array holds each operation's return value, with null for the constructor.- ListingIndex(10)
- upsert("a", 5, 5, 300, 2, 1)→ true
- upsert("b", 12, 8, 250, 3, 1)→ true
- upsert("c", 40, 40, 100, 1, 1)→ true
- search(0, 0, 20, 20, 1000, 0, 10)→ ["b","a"]
Listing c is cheapest but sits outside the box. The two inside come back sorted by price.
Keep three maps: listing id to its fields, listing id to the newest version seen (removals included), and cell to the set of listing ids in it. Search loops over the covering cells, then checks the exact box and the filters.
Map search over a versioned listing index
Click "Run" to execute your code
What is expected at each level
Mid level (SDE)
A design round is possible at mid level but less certain than at senior. If you get one, aim for about 80% breadth and 20% depth. You should agree on requirements, separate the listing database from the search index, and explain why a box query needs a geo index rather than two plain indexes. Interviewers do give hints, so take them when they come. The bar: a complete, working skeleton where a sold home eventually leaves search, and you can say how.
Senior (P4)
Senior loops include a system design round in every report, and this prompt came up in a March 2026 senior loop. Aim for about 60% breadth and 40% depth. You should bring the numbers yourself, spot the dual-write problem before you're asked, and reach the outbox and versioned indexer without prompting. Defend Postgres for the truth and a search engine for the reads, and name the ecosystem systems you assume. The bar: you pick the deep dive when asked, and you can explain how a late retry is stopped from undoing a sale.
Principal (P5)
A 2023 principal loop had two design rounds: this property search one and a separate one about scaling and fault-tolerant systems. Aim for about 40% breadth and 60% depth. Lead the session. Size the index and justify one shard with many replicas. Plan the degradation order, regional failover, a rebuild without downtime and alert matching as reverse search. Talk about cost and which team owns which system. The bar: the interviewer redirects you rather than rescues you, and every part can fail without taking search down.
Key Takeaways
- ✓Keep listings in Postgres as the truth and serve searches from a search index built as a copy.
- ✓Answer each map move with one query that mixes a geo box, filters, a sort and a cursor.
- ✓Feed the index through an outbox and change stream, with versions so late retries never undo a sale.
- ✓Name the Zillow systems you assume, such as saved searches and alerts, and show how they read your change stream.
Zillow interview guideKnow what Zillow asks before you walk in.
28 coding · 4 system design · 22 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.