redis-modules

majiayu000's avatarfrom majiayu000

Master Redis modules - RedisJSON, RediSearch, RedisTimeSeries, RedisBloom, and extending Redis functionality

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026

When & Why to Use This Skill

This Claude skill enables advanced management and optimization of Redis by leveraging powerful modules such as RedisJSON, RediSearch, RedisTimeSeries, and RedisBloom. It provides comprehensive support for handling complex JSON documents, implementing high-performance full-text search, analyzing temporal data, and utilizing memory-efficient probabilistic data structures. By simplifying configuration and troubleshooting, it helps developers build scalable, real-time applications with enhanced data processing capabilities.

Use Cases

  • Scenario 1: Storing, indexing, and querying complex JSON documents at high speed without the overhead of traditional relational databases.
  • Scenario 2: Implementing advanced full-text search, secondary indexing, and complex aggregations across large datasets using RediSearch.
  • Scenario 3: Collecting and analyzing high-volume time-series data for real-time monitoring, IoT metrics, or financial trends with RedisTimeSeries.
  • Scenario 4: Optimizing memory usage for large-scale membership testing (e.g., checking if a username exists) using Bloom and Cuckoo filters.
  • Scenario 5: Configuring and debugging Redis Stack environments, including module loading and schema definitions for production-ready deployments.
nameredis-modules
descriptionMaster Redis modules - RedisJSON, RediSearch, RedisTimeSeries, RedisBloom, and extending Redis functionality
sasmp_version"1.3.0"
bonded_agent08-redis-production
bond_typeSECONDARY_BOND
version"2.1.0"
last_updated"2025-01"
typestring
requiredtrue
enum[json, search, timeseries, bloom, graph]

Redis Modules Skill

RedisJSON

JSON document storage and manipulation.

# Set document
JSON.SET user:1 $ '{"name":"John","age":30,"tags":["redis"]}'

# Get path
JSON.GET user:1 $.name              # "John"
JSON.GET user:1 $                   # Full document

# Modify
JSON.NUMINCRBY user:1 $.age 1       # Increment
JSON.ARRAPPEND user:1 $.tags '"new"' # Add to array
JSON.SET user:1 $.email '"john@example.com"'

RediSearch

Full-text search and secondary indexing.

# Create index
FT.CREATE idx:users ON JSON PREFIX 1 user:
  SCHEMA
    $.name AS name TEXT SORTABLE
    $.email AS email TAG
    $.age AS age NUMERIC SORTABLE

# Search
FT.SEARCH idx:users "@name:John"
FT.SEARCH idx:users "@age:[25 35]"
FT.SEARCH idx:users "@email:{john@example.com}"

# Aggregate
FT.AGGREGATE idx:users "*"
  GROUPBY 1 @age
  REDUCE COUNT 0 AS count

RedisTimeSeries

Time-series data with aggregations.

# Create series
TS.CREATE sensor:temp RETENTION 86400000 LABELS type temperature location office

# Add samples
TS.ADD sensor:temp * 23.5
TS.MADD sensor:temp * 23.5 sensor:humidity * 45

# Query
TS.RANGE sensor:temp - + AGGREGATION avg 3600000  # Hourly avg
TS.MRANGE - + FILTER location=office

RedisBloom

Probabilistic data structures.

# Bloom filter
BF.ADD filter:emails "user@example.com"
BF.EXISTS filter:emails "user@example.com"  # 1 (might exist)
BF.EXISTS filter:emails "other@example.com" # 0 (definitely not)

# Cuckoo filter (allows delete)
CF.ADD filter:users "user123"
CF.DEL filter:users "user123"

# Count-Min Sketch
CMS.INCRBY sketch item1 5 item2 3
CMS.QUERY sketch item1  # ~5

Loading Modules

# redis.conf
loadmodule /opt/redis-stack/lib/rejson.so
loadmodule /opt/redis-stack/lib/redisearch.so
loadmodule /opt/redis-stack/lib/redistimeseries.so
loadmodule /opt/redis-stack/lib/redisbloom.so

Docker (Redis Stack)

docker run -p 6379:6379 redis/redis-stack:latest

Assets

  • docker-compose-stack.yml - Redis Stack with modules

References

  • MODULES_GUIDE.md - Complete guide

Troubleshooting

Module Not Loaded

MODULE LIST  # Check loaded modules

Fix: Check loadmodule path

Index Not Found

FT._LIST  # List indexes

Fix: Create index first


Error Codes

Code Name Recovery
MOD001 NOT_LOADED Check loadmodule
MOD002 NO_INDEX FT.CREATE index
MOD003 SCHEMA_ERR Fix schema definition