Stop Waiting for Elasticsearch to Boot: Tantivy Gets You Searching in Milliseconds
You know that feeling when you just want to grep through a few million documents, but spinning up a full search engine feels like launching a spaceship? Maybe you're building a CLI tool, a local desktop app, or a small service that needs real full-text search without the operational overhead of a dedicated server. That's the exact problem Tantivy solves. It's a full-text search library written in Rust that's inspired by Apache Lucene, but with a startup time so fast you'll blink and miss it.
What It Does
Tantivy is not a search engine server like Elasticsearch or Solr. It's a crate—a library you embed directly into your Rust application. Think of it as the engine under the hood, not the whole car. You bring your own logic, your own API, and your own deployment strategy. Tantivy handles the heavy lifting: indexing, tokenization, scoring, and querying.
Technically, it's strongly inspired by Lucene's design, which means it uses the same BM25 scoring algorithm that Lucene uses. That's a big deal if you're coming from the Java ecosystem—your relevance tuning knowledge transfers directly. The library supports a wide range of field types: text, integers, floats, dates, IPs, booleans, and even hierarchical facets. It also supports JSON fields, range queries, and a natural query language that feels familiar if you've ever used Lucene's syntax.
Under the hood, it uses memory-mapped files for fast access, SIMD integer compression on modern CPUs, and a compressed document store with LZ4 or Zstd options. All of this is designed to be fast and efficient, but the headline feature is that tiny startup time.
Why It's Cool
Let's be honest: the "10ms startup time" is the hook, but there's a lot more to like here.
-
It's genuinely fast. The README points to a dedicated benchmark breaking down performance across different query types and collections. It's not just marketing—they've built a separate benchmarking game repository to track it. Indexing English Wikipedia takes under 3 minutes on a desktop, which is a solid real-world data point.
-
The tokenizer story is impressive. Out of the box, you get stemming for 17 Latin languages. But the third-party ecosystem is where it gets interesting. There are tokenizers for Chinese (with two different options), Japanese (three different options), and Korean. If you're dealing with multilingual content, this is a huge win—you don't have to hack together your own segmentation logic.
-
It's a library, not a server. This is both a feature and a philosophy. You don't need to manage a separate process, deal with cluster configuration, or worry about memory ceilings in a JVM. You just add a dependency and call functions. For command-line tools and small applications, this is a game changer—you get real search without the infrastructure tax.
-
The feature list is surprisingly complete. Incremental indexing, multithreaded indexing, phrase queries, faceted search, range queries, and an aggregation collector with histogram and stats metrics. There's even a LogMergePolicy with deletes, which is the kind of detail that tells you the authors have thought about real-world usage. And yes, there's a "cheesy logo with a horse," which I appreciate for the honesty.
-
It's actively maintained and community-backed. The Quickwit team built this, and they're using it to power their own distributed search engine. That means it's not abandonware—it's the foundation of a commercial-grade product. The OpenSSF scorecard badge suggests they care about security and supply chain hygiene too.
There's one thing it deliberately doesn't do: distributed search. The README is upfront about that. If you need to shard across multiple machines, you should look at Quickwit instead. That's a refreshingly honest scope statement.
How to Try It
Tantivy works on stable Rust and supports Linux, macOS, and Windows. If you have Rust installed, you can add it to your project with:
cargo add tantivy
Or add it to your Cargo.toml manually:
[dependencies]
tantivy = "0.22"
The basic workflow is: define a schema, create an index, add documents, then search. The documentation on docs.rs is the best place to start, and there's a benchmark repository if you want to see how it performs on your own data.
If you want to see a real-world example of Tantivy in action, check out Quickwit, the distributed search engine built on top of it. That's the best way to understand what this library is capable of at scale.
The repository is at github.com/quickwit-oss/tantivy, and there's an active Discord community if you run into issues.
Final Thoughts
Tantivy is best for developers who need real full-text search but don't want to manage a search cluster. If you're building a CLI tool, a local app, or a small service in Rust, this is probably exactly what you need. The Lucene-inspired design means it's battle-tested in concept, and the Rust implementation means it's fast and safe. The startup time alone makes it worth trying for your next project—you'll wonder why you ever waited for a server to boot just to search a few files.
Follow @githubprojects for more developer tools and open source projects.