Store term → documents directly#
A normal primary-key index answers “find document 42.” Text search asks “which documents contain distributed systems?” An inverted index reverses that relationship.
Three tiny documents
Doc 1: "system design interview"
Doc 2: "system design patterns"
Doc 3: "coding interview"
system → [1, 2]
design → [1, 2]
interview → [1, 3]
patterns → [2]
coding → [3]Postings can carry term frequency, field identity, and positions when scoring or phrase behavior requires them. BM25 is a common relevance model, but interview depth is why the mapping supports candidate retrieval - not deriving its formula.
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- Clusters, nodes, and shardsElastic Documentation