AlgoViz

Design a Distributed Search Engine (Elasticsearch)

hard 75 min

Find the best ten of ten billion documents while people wait: shards, replicas, scoring, immutable segments, and a rebuild plan.

Where it shows up

The same pattern appears across everyday software.

  • Online shops

    Words, filters for price and brand, and counts beside each filter. Stock changes often, so the page checks stock again before selling.

  • Log search

    Documents arrive in time order. A new index for each period makes deletion cheap: drop the whole old index.

  • Help centres

    A few thousand articles. One machine, or the database's own text search, is enough.

  • Code search

    People search for pieces of words and symbols. Indexes of short character groups suit this better than word indexes.

  • Company documents

    Every result must respect permissions. The permission filter is part of the query, never a step in the browser.

  • Elasticsearch

    Its documentation advises shards between 10 and 50 GB with fewer than 200 million documents each, as a starting point to test.