Elasticsearch & Lucene (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
Lucene Inverted Index Deep Dive: Term dictionary, Term index (FST), and Postings lists with Skip lists.
senior LevelMost AskedelasticsearchAdvanced Internals
In Simple Words: An inverted index maps terms to the list of document IDs that contain them:
- Term Index (FST - Finite State Transducer): Stored in RAM. A compressed prefix automaton that points to offsets in the Term Dictionary, avoiding disk lookups for every term.
- Term Dictionary: Alphabetically sorted list of all unique terms stored on disk.
- Postings Lists: Linked lists of Document IDs containing the term, along with term frequencies and byte offsets for phrase searches.
- Skip Lists: Allows Lucene to skip large blocks of irrelevant document IDs during boolean AND/OR intersections, achieving sub-millisecond query evaluation.