Indexing in distributed search
medium 28 minHow documents become a searchable index spread over many machines: the analysis chain, posting lists and their compression, segments and merges, and the choice between splitting by document or by term.
Remember it
The few things worth knowing cold, and how to make them stick.
Memory hook
INDEX: Inverted, Normalise, Distribute, Extract, eXpress.
Labelled drawers in a button shop: a label for each word, a slip with card numbers, a small cabinet for today's cards.
Cheat sheet
- Posting
- doc, count, positions
- Lists
- deltas, then few bytes
- Variable bytes
- at best 4x
- Refresh
- about 1 s, findable
- Log
- safe
- Merge
- fewer segments, deletes gone
- Split
- by document id
- Rebuild
- new index, then alias
Spot it when you see
- Search by words over many documents.
- Index larger than a machine.
- Results must be fresh within seconds.
Tricks that stick
- I is for Inverted: term to documents.
- N is for Normalise, E for Extract: the chain.
- D is for Distribute: shards.
- X is for eXpress: find the term, read its list.
- Document, tokenize, stem, index, search.
Do not forget
- Home-made stemmers.
- Losing positions of removed words.
- Refresh after every write.
- Splitting by term.
- Indexing a document twice.