Repolode
valeriansaliou

valeriansaliou/sonic

Lightweight, schema-less search backend that indexes text and returns identifiers, offered as a small alternative to Elasticsearch.

Open-source alternative to:Elasticsearch

Stars
21,367
Forks
618
Open issues
53
Last commit
15 hours ago

What is it?

Sonic is a search backend written in Rust. It stores search terms in collections grouped into buckets and returns object identifiers rather than documents, so applications keep their full data in an external database and use Sonic only to find matching IDs. It supports insert and remove operations while the server runs, typo correction, word auto-completion through a suggest command, and stop-word removal for a wide range of languages.

Sonic is designed for teams that need search without the resource cost of a full-featured engine. The project reports that it uses roughly 30 MB of RAM under load and responds to queries in the microsecond range, with benchmarks measured on a single machine. Clients talk to it over Sonic Channel, a simple TCP protocol, and official libraries exist for Node.js, Rust and PHP, with many community clients for other languages.

Sonic has no HTTP API and does not fit its index in memory, so it expects SSD-backed storage for good query performance.

Key features

  • 01Stores identifiers only, pointing back to records in an external database.
  • 02Corrects typos in queries when exact matches are insufficient.
  • 03Auto-completes words in real time via the suggest command.
  • 04Supports adding and removing entries while the server is running.
  • 05Removes stop words for many languages and applies stemming for some.
  • 06Speaks a simple TCP protocol called Sonic Channel, with client libraries in several languages.

Use cases

  • Adding full-text search to a chat or helpdesk product where the message data lives in a separate database.
  • Building word suggestion boxes in an end-user search interface.
  • Running a lightweight search service on a small server instead of Elasticsearch.

Quick start

  1. 1

    Install Sonic from Cargo

    cargo install sonic-server
  2. 2

    Get the sample config.cfg from the repository and adjust it to your environment

  3. 3

    Run Sonic with your configuration file

    ./sonic -c /path/to/config.cfg

Things to know

  • Building needs RocksDB system dependencies such as clang, libclang-dev and llvm-dev.
  • Sonic returns only identifiers, so you need an external database to load the full records.
  • There is no HTTP endpoint; you must interact through the Sonic Channel protocol or a client library.

Topics

FAQ

What is sonic?
Lightweight, schema-less search backend that indexes text and returns identifiers, offered as a small alternative to Elasticsearch. Sonic is a search backend written in Rust. It stores search terms in collections grouped into buckets and returns object identifiers rather than documents, so applications keep their full data in an external database and use Sonic only to find matching IDs. It supports insert and remove operations while the server runs, typo correction, word auto-completion through a suggest command, and stop-word removal for a wide range of languages.
Is sonic free to use? What license does it have?
sonic is open source under the MPL-2.0 license. Check the license terms before using it in commercial products.
Is sonic still maintained?
Actively maintained. The last commit to sonic was on Oct 21, 2026.
What can I use sonic for?
Adding full-text search to a chat or helpdesk product where the message data lives in a separate database. Building word suggestion boxes in an end-user search interface. Running a lightweight search service on a small server instead of Elasticsearch.
How do I install sonic?
Install Sonic from Cargo: cargo install sonic-server Get the sample config.cfg from the repository and adjust it to your environment Run Sonic with your configuration file: ./sonic -c /path/to/config.cfg
Where can I get sonic?
The source code and installation instructions are on GitHub: https://github.com/valeriansaliou/sonic

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects