Convert Figma logo to code with AI

RediSearch logoRediSearch

A query and indexing engine for Redis, providing secondary indexing, full-text search, vector similarity search and aggregations.

5,857
554
5,857
545

Top Related Projects

Free and Open Source, Distributed, RESTful Search Engine

⚡️ A fully-featured and blazing-fast JavaScript API client to interact with Algolia.

A lightning-fast search engine API bringing AI-powered hybrid search to your sites and applications.

Quick Overview

RediSearch is a powerful full-text search and secondary indexing engine for Redis. It provides advanced search capabilities, including complex queries, aggregations, and real-time indexing, while leveraging Redis' in-memory data structure for high performance and low latency.

Pros

  • High performance and low latency due to in-memory processing
  • Rich query language with support for complex queries and aggregations
  • Real-time indexing and search capabilities
  • Seamless integration with existing Redis deployments

Cons

  • Increased memory usage compared to standard Redis
  • Learning curve for users unfamiliar with specialized search query syntax
  • Limited support for certain advanced text analysis features compared to dedicated search engines

Code Examples

  1. Creating an index:
from redisearch import Client, TextField, NumericField, TagField

client = Client("myIndex")
client.create_index([
    TextField("title"),
    TextField("body"),
    NumericField("price"),
    TagField("categories")
])
  1. Adding documents to the index:
client.add_document("doc1", 
    title="Introduction to RediSearch",
    body="RediSearch is a powerful search engine...",
    price=9.99,
    categories="software,database"
)
  1. Performing a search query:
from redisearch import Query

# Search for documents containing "RediSearch" in the title or body
results = client.search(Query("RediSearch").limit_fields("title", "body"))

for doc in results.docs:
    print(f"Title: {doc.title}, Price: {doc.price}")

Getting Started

To get started with RediSearch:

  1. Install Redis with RediSearch module:

    docker run -p 6379:6379 redislabs/redisearch:latest
    
  2. Install the Python client:

    pip install redisearch
    
  3. Create a client and index:

    from redisearch import Client, TextField
    
    client = Client("myIndex")
    client.create_index([TextField("content")])
    
  4. Add documents and perform searches as shown in the code examples above.

Competitor Comparisons

Free and Open Source, Distributed, RESTful Search Engine

Pros of Elasticsearch

  • More mature and feature-rich, with advanced analytics and machine learning capabilities
  • Highly scalable and distributed architecture, suitable for large-scale deployments
  • Extensive ecosystem with plugins, integrations, and community support

Cons of Elasticsearch

  • Higher resource consumption and complexity, requiring more setup and maintenance
  • Steeper learning curve due to its extensive feature set
  • Can be slower for simple search operations compared to RediSearch

Code Comparison

RediSearch:

FT.CREATE myIndex ON HASH PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5.0 body TEXT
FT.ADD myIndex doc:1 1.0 FIELDS title "Hello" body "World"
FT.SEARCH myIndex "Hello World" LIMIT 0 10

Elasticsearch:

PUT /my_index
POST /my_index/_doc/1
{
  "title": "Hello",
  "body": "World"
}
GET /my_index/_search
{
  "query": {
    "match": {
      "title": "Hello World"
    }
  }
}

Both RediSearch and Elasticsearch offer powerful search capabilities, but they cater to different use cases. RediSearch is lightweight, fast, and tightly integrated with Redis, making it ideal for simpler search requirements and real-time applications. Elasticsearch, on the other hand, excels in complex, large-scale search scenarios with advanced analytics needs.

⚡️ A fully-featured and blazing-fast JavaScript API client to interact with Algolia.

Pros of algoliasearch-client-javascript

  • Easy-to-use JavaScript client for Algolia's hosted search engine
  • Comprehensive documentation and extensive API coverage
  • Built-in support for various JavaScript frameworks and environments

Cons of algoliasearch-client-javascript

  • Requires a paid Algolia subscription for production use
  • Limited control over search infrastructure compared to self-hosted solutions
  • Dependency on external service may introduce latency for some users

Code Comparison

algoliasearch-client-javascript:

const client = algoliasearch('APP_ID', 'API_KEY');
const index = client.initIndex('your_index_name');
index.search('query').then(({ hits }) => {
  console.log(hits);
});

RediSearch:

from redisearch import Client, Query

client = Client('your_index_name')
query = Query('query').paging(0, 10)
results = client.search(query)
print(results.docs)

Summary

algoliasearch-client-javascript offers a user-friendly solution for integrating Algolia's hosted search engine into JavaScript applications. It provides extensive documentation and framework support but requires a paid subscription and introduces dependency on an external service. RediSearch, on the other hand, is an open-source, self-hosted solution that offers more control over the search infrastructure but may require more setup and maintenance. The choice between the two depends on specific project requirements, budget constraints, and desired level of control over the search functionality.

A lightning-fast search engine API bringing AI-powered hybrid search to your sites and applications.

Pros of Meilisearch

  • Easy setup and configuration with minimal indexing parameters required
  • Typo-tolerance and natural language support out of the box
  • RESTful API and multiple SDK options for easy integration

Cons of Meilisearch

  • Limited advanced querying capabilities compared to RediSearch
  • Lacks some of the more sophisticated features like aggregations and custom scoring

Code Comparison

Meilisearch indexing:

client.index('movies').add_documents([
  { id: 1, title: 'Carol', genres: ['Romance', 'Drama'] },
  { id: 2, title: 'Wonder Woman', genres: ['Action', 'Adventure'] },
])

RediSearch indexing:

client.create_index([
    TextField('title', weight=5.0),
    TagField('genres')
])
client.add_document('movie:1', title='Carol', genres=['Romance', 'Drama'])
client.add_document('movie:2', title='Wonder Woman', genres=['Action', 'Adventure'])

Both examples demonstrate adding documents to an index, but RediSearch requires explicit index creation with field definitions, while Meilisearch automatically infers the schema. RediSearch offers more control over field types and weights, which can be beneficial for complex search scenarios.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Discord

Total CoverageUnit TestsFlow Tests
codecovcodecovcodecov

Latest Release

Latest 2.8 Latest 2.6

RediSearch

[!NOTE] Starting with Redis 8, Redis Query Engine (RediSearch) is integral to Redis. You don't need to install this module separately.

We no longer release standalone versions of RediSearch.

See https://github.com/redis/redis

Overview

RediSearch is a Redis module that provides querying, secondary indexing, and full-text search for Redis. To use RediSearch, you first declare indexes on your Redis data. You can then use the RediSearch query language to query that data.

RediSearch uses compressed, inverted indexes for fast indexing with a low memory footprint.

RediSearch indexes enhance Redis by providing exact-phrase matching, fuzzy search, and numeric filtering, among many other features.

Getting started

If you're just getting started with RediSearch, check out the official RediSearch tutorial. Also, consider viewing our RediSearch video explainer.

Documentation

The RediSearch documentation provides a complete overview of RediSearch. Helpful sections include:

Questions?

Got questions? Join us in #redisearch on the Redis Discord server.

RediSearch features

  • Full-Text indexing of multiple fields in Redis hashes
  • Incremental indexing without performance loss
  • Document ranking (using BM25 as default, with optional user-provided weights). All available scoring methods described here
  • Field weighting
  • Complex boolean queries with AND, OR, and NOT operators
  • Prefix matching, fuzzy matching, and exact-phrase queries
  • Support for double-metaphone phonetic matching
  • Auto-complete suggestions (with fuzzy prefix suggestions)
  • Stemming-based query expansion in many languages (using Snowball)
  • Support for Chinese-language tokenization and querying (using Friso)
  • Numeric filters and ranges
  • Geospatial searches using Redis geospatial indexing
  • A powerful aggregations engine
  • Supports for all utf-8 encoded text
  • Retrieve full documents, selected fields, or only the document IDs
  • Sorting results (for example, by creation date)
  • Geoshape indexing
  • Vector similarity search - KNN, filtered KNN and range query

Cluster support

RediSearch has a distributed cluster version that scales to billions of documents across hundreds of servers. At the moment, distributed RediSearch is available as part of Redis Cloud and Redis Enterprise Software.

See RediSearch on Redis Enterprise for more information.

License

Starting with Redis 8, RediSearch is licensed under your choice of: (i) Redis Source Available License 2.0 (RSALv2); (ii) the Server Side Public License v1 (SSPLv1); or (iii) the GNU Affero General Public License version 3 (AGPLv3). Please review the license folder for the full license terms and conditions. Prior versions remain subject to (i) and (ii).

Code contributions

By contributing code to this Redis module in any form, including sending a pull request via GitHub, a code fragment or patch via private email or public discussion groups, you agree to release your code under the terms of the Redis Software Grant and Contributor License Agreement. Please see the CONTRIBUTING.md file in this source distribution for more information. For security bugs and vulnerabilities, please see SECURITY.md.