Elasticsearch
maang.io System Design Series
Elasticsearch takes Lucene and distributes it: an index splits into shards (each a Lucene index) with replicas, spread across nodes. It adds near-real-time indexing (buffer β refresh β segment, with a translog for durability), scatter-gather query then fetch, and a rich query DSL and aggregations. It's the default answer for full-text search and log analytics at scale.
This deep dive comes in four parts:
- Foundations & Core Concepts β indices, shards/replicas, and document routing.
- Internals β the near-real-time model, translog, refresh/flush, and segment merges, with worked numbers.
- Advanced Internals β node roles, the query/fetch phases, mappings, and doc values for aggregations.
- Interview β Staff/Principal Q&A: sizing shards, and when not to use it as a primary store.
Elasticsearch β Part 4: System Design & Interview Mastery
maang.io System Design Series
What is this?
You now know Elasticsearch from the inverted index up through the scatter-gather cluster. This chapter is where that knowledge earns the offer. An interviewer doesn't want to hear you recite "Elasticsearch uses an inverted index" β they want to watch you reach for it at the right moment, wire it into a larger system correctly, and defend the trade-offs when they push back, especially the big one: it is not your source of truth. That distinction between reciting a fact and wielding it is the whole senior signal.
We'll do two things: see where Elasticsearch fits in real designs (with a worked architecture), then run a mock interview β for each question, what they're really asking, a model answer, and the senior line that tells the interviewer you've operated this thing for real. The head-librarian-and-branches picture from the earlier parts carries straight through.
The one-line idea: Interviewers use Elasticsearch to test whether you can bolt a search/analytics engine onto a system without making it the system β keep the database as the source of truth, stream data into ES for querying, and live honestly with near-real-time consistency, no transactions, and fixed shard counts.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson