SevyDevy

Design elasticsearch

PremiumDistributed infrastructureMedium

  • Inverted index
  • Sharding
  • Replica shards

Quick answer

This distributed infrastructure interview question asks you to design elasticsearch. Aim for a design that keeps working across many machines and failures, then explain partitioning, replication, coordination and trade-offs. Interviewers want to see how you reason about failures, consistency and scale.

The problem

Design Elasticsearch, a distributed full-text search engine. It splits each index into shards, each an inverted index, replicates them across nodes, and makes new documents searchable within about a second. The hard parts are routing writes and fanning out queries across shards, keeping replicas in sync, and recovering from node loss without losing writes.

The first workload is a marketplace's product and review search: 500 million documents, frequent price and stock updates, and 6,000 searches per second at peak.

What must the system do?

  • Index documents: Create, update and delete JSON documents by ID, one at a time or in bulk.
  • Full-text search: Search text fields with relevance scoring, plus filters, sorting and pagination.
4 more requirementsUnlock to see all

How well must it do it?

  • Search latency: p99 under 200 ms at 6,000 searches per second.
  • Freshness: Changes searchable within 2 s.
3 more requirementsUnlock to see all

What scale should you design for?

Use these numbers in your estimates.

The scale numbers unlock with this questionUnlock

Key concepts

  • Inverted index
  • Sharding
  • Replica shards
  • Near real time search
  • Scatter gather
  • Lucene segments

How you’ll practise

6 short steps · save and come back any time
  1. Requirements
  2. Estimate
  3. Data model and API
  4. Partitioning and replication
  5. Consistency and failures
  6. Wrap-up

Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.

What do interviewers look for?

In any distributed infrastructure design round.

  • States the consistency and availability guarantees up front
  • Explains partitioning and replication choices
  • Describes how nodes agree and recover after failures
  • Handles network partitions and slow nodes
  • Plans for adding and removing capacity safely
  • Names the trade-offs instead of hiding them

Questions people ask about this interview question

Which design type is this question?
It is a distributed infrastructure question. You design elasticsearch and explain your choices the way you would in an interview.
Is this question asked at entry level?
It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
What should I cover first?
Start with the guarantees the system must give and the failures it must survive. Agree on scope with the interviewer before you design anything.
Can I practise it for free?
It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.

Related questions

Updated · Written by the SevyDevy team

Premium questionSign up free, then unlock it