Earlybird: The Real-Time Search Index

Search is a completely separate system from timeline delivery. Earlybird is a real-time inverted index (built on Lucene) that makes a tweet findable by content within seconds. The timeline answers "what did the people I follow say?"; Earlybird answers "who said this word?" — two different questions, two different systems.

The short version

The timeline (see the parts from fan-out on write to eventual consistency) is a mailbox system — organized by relationship ("tweets from accounts I follow"). Search is a library card catalog — organized by content ("every tweet containing 'earthquake'"). You cannot answer "show me all tweets mentioning the World Cup" by looking in mailboxes; you need an index of the words themselves, built on a completely different key (term, not viewer), using a completely different structure (a global inverted index — term → posting list of tweet IDs — not a per-user sorted set). Trying to bolt content search onto the timeline structure is hopeless; they're indexed on different keys. So Twitter built Earlybird as a distinct system.

A posted tweet triggers two independent downstream deliveries off the same write event — fan-out to timelines (see fan-out on write/hybrid model) and indexing into Earlybird — running as parallel, independent pipelines with different scaling axes (timeline scales with followers; search scales with query terms and corpus size) and, notably, different queues, since fan-out needs per-author ordering and search ingestion doesn't.

Where the two worlds touch: the algorithmic timeline (see algorithmic timeline) blurs this line. To find out-of-network candidates ("tweets from people you don't follow that you might like"), the ranking system queries content/engagement indexes — conceptually search-like retrieval — and folds the results into the candidate set. So search-style retrieval becomes an input to the modern timeline, even though classic chronological delivery and search are separate. Hold that for the algorithmic timeline part.

For the full deep dive

The inverted index, real-time ingestion via Lucene segments, the realtime-vs-archive cluster split, root/leaf query fan-out, ranking, and how the search-ingestion queue differs from the fan-out queue are all covered at staff depth in a companion guide:

→ Twitter Search (Earlybird) — Staff-Level Study Guide

That guide also draws out the sharpest cross-document insight: Earlybird's realtime/archive split is this document's hybrid model part hybrid model, reapplied — the same "two regimes, opposite cost profiles, merge at query time" pattern, just partitioned by tweet age instead of follower count.