---
title: "A brief history of code search at GitHub"
description: "GitHub's code search evolved from a public-only Solr index plus `git grep` for private repos, to a decade-long Elasticsearch deployment that grew to 162 nodes, 1.25PB of storage and over 53 billion indexed files."
url: "https://swe.quest/articles/a-brief-history-of-code-search-at-github-ac152c8901d98c95"
canonical: "https://github.blog/engineering/architecture-optimization/a-brief-history-of-code-search-at-github/"
source: "GitHub Engineering"
published: "2021-12-15"
difficulty: "medium"
kind: "Case study"
reading_minutes: 13
tags: ["search","scalability","developer-tools"]
---

# A brief history of code search at GitHub

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2021-12-15, 13 min read, Case study. Original: [https://github.blog/engineering/architecture-optimization/a-brief-history-of-code-search-at-github/](https://github.blog/engineering/architecture-optimization/a-brief-history-of-code-search-at-github/)

## Summary

GitHub's code search evolved from a public-only Solr index plus \`git grep\` for private repos, to a decade-long Elasticsearch deployment that grew to 162 nodes, 1.25PB of storage and over 53 billion indexed files. Natural-language text analysis fits source code poorly. GitHub's custom tokenizer dropped punctuation and could not do substring or regex matching. An experiment that indexed special characters made indexing 43-100% slower, grew the index 18-28% and slowed typical queries about 2.1x. A short-lived exact-match beta also failed to balance its resource cost against corpus growth. Existing trigram engines like Russ Cox's and Zoekt also fell short at GitHub's scale, so GitHub built Blackbird, a bespoke engine targeting sub-second p95 global exact-match and regex queries without using much more resources than the Elasticsearch cluster.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)

## Prerequisites

- inverted indexes
- text tokenization
- Elasticsearch basics ([easy posts on Search](https://swe.quest/tags/search.md?difficulty=easy))

## Keywords

GitHub code search, Elasticsearch, Solr, Blackbird, trigram index, Zoekt, git grep, Lucene

## Related posts

- [The technology behind GitHub’s new code search](https://swe.quest/articles/the-technology-behind-github-s-new-code-search-7c9e939ab132b5db.md): GitHub Engineering · 2023-02-06 · Medium · 13 min read · Search, Rust, System design, Scaling, Data structures
  GitHub built Blackbird, a Rust code search engine, because general text search engines handled punctuation, regex, and GitHub's scale poorly, and brute-force grep would yield about 0.01 QPS.
- [How GitHub Docs’ new search works](https://swe.quest/articles/how-github-docs-new-search-works-0f03307c816bdb86.md): GitHub Engineering · 2023-03-09 · Medium · 10 min read · Search, JavaScript
  GitHub Docs replaced its in-memory Node.js site search, which loaded serialized indexes from the Git repo for eight languages and five versions, with Elasticsearch.
- [Fast regex search: indexing text for agent tools · Cursor](https://swe.quest/articles/fast-regex-search-indexing-text-for-agent-tools-cursor-45908cf7bb0688f8.md): Cursor · 2026-03-23 · Medium · 20 min read · Search, Data structures, Algorithms, AI agents, Developer tools
  Agents lean heavily on regex search, and ripgrep's full scan can take over 15 seconds in large monorepos, so Cursor builds local indexes specifically to accelerate regex queries.
- [GitHub Issues search now supports nested queries and boolean operators: Here’s how we (re)built it](https://swe.quest/articles/github-issues-search-now-supports-nested-queries-and-boolean-operators-here-s-2684ca9cc7ff5489.md): GitHub Engineering · 2025-05-13 · Medium · 9 min read · Search, Ruby, Deployment, Refactoring & migrations, Testing
  GitHub rebuilt Issues search to support AND/OR operators and nested parentheses by replacing the flat-list parser with a PEG grammar (via the Ruby parslet library) that produces an abstract syntax tree.
- [Building a code search engine with Turso](https://swe.quest/articles/building-a-code-search-engine-with-turso-6a98c3f86064a46b.md): Turso · 2026-02-26 · Medium · 6 min read · Vector search, Search, SQLite, AI agents, RAG & retrieval
  Codemogger is an open-source code indexer and search engine for AI agents, built on a single local Turso (SQLite-compatible) file using native vector columns and full-text search.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
