# Design a search engine like Elasticsearch: system design interview question

> The engine balances fast document visibility, ranked results, and complete searches during shard failures.

Source: https://sysround.com/questions/design-search-engine-like-elasticsearch
Updated: 2026-11-05


Difficulty: hard. Levels: Senior, Staff+.

## How the interviewer opens it

"Design a distributed search engine for a large document collection. It must support near-real-time document changes, ranked full-text results, and shard failures."

## What to clarify first

- Corpus
- Traffic and read:write mix
- Query features
- Document changes
- Freshness and consistency
- Latency
- Result order
- Availability and incomplete results
- Durability and deployment
- System boundary

## Scope of a strong answer

Core requirements:

- Accept document upserts and deletes
- Make document changes searchable within the freshness target
- Return ranked full-text results
- Resume complete searches after one node or zone fails

Usually out of scope:

- Collect documents with a crawler
- Support vector search or personalized results
- Implement a complete query language
- Operate across multiple regions

## What interviewers probe

### Document visibility

A durable acknowledgement does not mean a query can see the change. Retries and late updates can also restore deleted documents.

### Ranked search results

Each shard sees only part of the corpus. The engine must compare scores and preserve document versions throughout each query.

### Distributed query execution

Every unrestricted query contacts many shards. Common terms and one slow shard can consume the entire latency budget.

### Durability and availability

A node can hold a durable write before search can see it. Failover must preserve writes and control result freshness.

## Common mistakes

- The design names Elasticsearch but does not explain its index or failure behavior.
- The design treats a durable acknowledgement as proof that a new document is searchable.
- The design compares shard scores without a defined score order.
- The design hides missing shards and returns incomplete results as complete.
- The design gives a shard count without a query cost estimate.
- The design permits an old document version to appear after a delete.

## The bar by level

- **Senior:** Defines version rules, durable acknowledgements, reader refresh, score semantics, and partial result behavior. Estimates query amplification. Explains recovery without lost acknowledged writes.
- **Staff+:** Defines guarantees during partitions and zone loss. Uses visible checkpoints, election rules, and capacity estimates to justify them. Compares shard size, replica count, merge cost, and score accuracy. Explains safe shard movement and recovery under continued load.

Practice this question with an AI interviewer: https://sysround.com/practice/new?problem=distributed-search-engine


---
SysRound (https://sysround.com) is an AI practice tool for system design interviews. It has a voice or typed AI interviewer and a shared whiteboard. At the end, you get feedback on each skill and a model answer. The AI feedback can be wrong.
