# Searching Billions of Documents with Redis

- Speaker: [Dvir Volk](/wiki/speakers/dvir-volk.md)
- Event: [Reversim Summit 2017](/wiki/years/2017.md)
- Video: https://www.youtube.com/watch?v=tgDpQUiykjg
- Transcript: [/transcripts/2017/29-tgDpQUiykjg.md](/transcripts/2017/29-tgDpQUiykjg.md)
- Language: Hebrew · Type: talk · Level: intermediate
- Topics: [Performance](/wiki/topics/performance.md), [Databases](/wiki/topics/databases.md), [Open Source](/wiki/topics/open-source.md), [Scalability](/wiki/topics/scalability.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

The speaker introduces an open-source search engine module built for Redis that enables fast full-text, numeric, and geo-spatial indexing and searching. Traditionally, building indices directly on basic Redis data structures is inefficient, memory-intensive, and hard to maintain. By leveraging the Redis module API written in C, the speaker's search engine treats Redis as an application framework while offering high write/read concurrency and scalability across multiple instances. Ultimately, developers learn how to perform complex queries and scale search operations efficiently without leaving the Redis ecosystem.

## Key points

- [1:10](https://www.youtube.com/watch?v=tgDpQUiykjg&t=70s) Redis provides great, fast data structures, but natively lacks built-in full-text indexing capabilities.
- [3:32](https://www.youtube.com/watch?v=tgDpQUiykjg&t=212s) Attempting to build search indices using sets and sorted sets in Redis is complex, memory-intensive, and slow at scale.
- [5:43](https://www.youtube.com/watch?v=tgDpQUiykjg&t=343s) The introduction of modules in Redis 4.0 via a C API allows developers to extend Redis with new commands and data structures.
- [6:47](https://www.youtube.com/watch?v=tgDpQUiykjg&t=407s) The speaker presents a newly developed open-source search engine written in C that is built specifically for Redis.
- [9:05](https://www.youtube.com/watch?v=tgDpQUiykjg&t=545s) A brief demonstration shows how to create an index with a schema, insert documents, and execute filtered queries.
- [13:44](https://www.youtube.com/watch?v=tgDpQUiykjg&t=824s) The search engine features asynchronous, non-blocking indexing and garbage collection, allowing thousands of concurrent reads and writes.
- [23:34](https://www.youtube.com/watch?v=tgDpQUiykjg&t=1414s) Scaling the search engine to billions of documents across multiple servers is achieved by partitioning indices by document IDs and using a coordinator layer.
- [26:39](https://www.youtube.com/watch?v=tgDpQUiykjg&t=1599s) Performance benchmarks demonstrate that the Redis search module achieves significantly higher throughput and lower latency than other popular search engines.

## Takeaways

- Use Redis modules to extend functionality and implement custom data structures when native data types fall short.
- Avoid manually building full-text search indices with standard Redis sets and sorted sets in production due to memory and performance bottlenecks.
- Partition indices by document ID across multiple instances to scale search workloads effectively over billions of documents.

## Questions this talk answers

- How can you implement full-text search in Redis without using inefficient custom sets?
- How do Redis modules enable writing custom data structures and commands in C?
- How does partitioning index data by document ID allow a Redis search cluster to scale to billions of documents?

## Technologies

Redis, Python, Java, Go, PHP, Ruby, Elasticsearch, Solr

## Tags

c, indexing, open source, performance, redis, scalability, search engine
