{"id":119564,"date":"2026-07-06T15:25:15","date_gmt":"2026-07-06T09:55:15","guid":{"rendered":"https:\/\/www.guvi.in\/blog\/?p=119564"},"modified":"2026-07-06T15:25:17","modified_gmt":"2026-07-06T09:55:17","slug":"redis-stack-tutorial","status":"publish","type":"post","link":"https:\/\/www.guvi.in\/blog\/redis-stack-tutorial\/","title":{"rendered":"Redis Stack Tutorial: JSON, Search, and Time-Series in One Database\u00a0\u00a0"},"content":{"rendered":"\n<p>Plain Redis is the fastest in-memory cache in the world. But Redis Stack takes that foundation and adds full-text search, native JSON support, time-series storage, and probabilistic data structures like bloom filters, all accessible through the same Redis connection your app already uses. This Redis Stack tutorial shows you how to run it with Docker, store JSON documents, create a full-text search index, query it, and connect from Python, starting from zero.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>TL;DR Summary<\/strong><\/h2>\n\n\n\n<ul>\n<li>Redis Stack bundles Redis with four powerful modules: RediSearch, RedisJSON, RedisTimeSeries, and RedisBloom, in a single Docker image.<\/li>\n\n\n\n<li>Setup takes under 2 minutes and includes a built-in RedisInsight GUI at port 8001.<\/li>\n\n\n\n<li>Redis Stack enables full-text search, secondary indexing, JSON document storage, and time-series queries without adding any new database to your stack.<\/li>\n\n\n\n<li>Use Redis Stack when you want Redis as a primary data store with search and analytics, not just a cache.<\/li>\n\n\n\n<li>Free to use locally. Redis Cloud offers a managed free tier with 30 MB.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is Redis Stack?<\/strong><\/h2>\n\n\n\n<p>Redis Stack bundles four Redis modules into a single, easy-to-deploy package: RedisJSON, RediSearch, RedisTimeSeries, and RedisBloom. It also includes RedisInsight, a visualisation tool for understanding and optimising Redis data.<\/p>\n\n\n\n<p>Here is what each module adds:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Module<\/strong><\/td><td><strong>What It Does<\/strong><\/td><\/tr><tr><td>RedisJSON<\/td><td>Store, update, and query native JSON documents<\/td><\/tr><tr><td>RediSearch<\/td><td>Full-text search, secondary indexing, and vector similarity search<\/td><\/tr><tr><td>RedisTimeSeries<\/td><td>Efficient storage and aggregation of time-series metrics<\/td><\/tr><tr><td>RedisBloom<\/td><td>Probabilistic structures: Bloom filters, Cuckoo filters, Count-Min Sketch<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The result is a single database that handles caching, search, analytics, and JSON storage without adding separate Elasticsearch, MongoDB, or InfluxDB instances.<\/p>\n\n\n\n<p>Redis Stack sits at the centre of modern backend architectures that need caching, search, and analytics without separate infrastructure for each. HCL GUVI&#8217;s<a href=\"https:\/\/www.guvi.in\/zen-class\/full-stack-development-course\/?utm_source=blog&amp;utm_medium=hyperlink&amp;utm_campaign=redis-stack-tutorial\" target=\"_blank\" rel=\"noreferrer noopener\"> Full Stack Development Course<\/a> and<a href=\"https:\/\/www.guvi.in\/zen-class\/ai-software-development-course\/?utm_source=blog&amp;utm_medium=hyperlink&amp;utm_campaign=redis-stack-tutorial\" target=\"_blank\" rel=\"noreferrer noopener\"> AI Software Development Course<\/a> are both IITM Pravartak certified and build the backend depth that makes tools like Redis Stack practical in production.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Redis Stack Tutorial: Installation with Docker<\/strong><\/h2>\n\n\n\n<p>Run Redis Stack with one Docker command. Redis listens on port 6379 and RedisInsight (the GUI) runs on port 8001.<\/p>\n\n\n\n<p><strong>docker run -d &#8211;name redis-stack -p 6379:6379 -p 8001:8001 -v redis-stack-data:\/data redis\/redis-stack:latest<\/strong><\/p>\n\n\n\n<p>Open <strong>http:\/\/localhost:8001<\/strong> in your browser to access the RedisInsight GUI where you can inspect keys, run commands, and visualise data without touching the CLI.<\/p>\n\n\n\n<p>Verify the modules loaded successfully by connecting with redis-cli:<\/p>\n\n\n\n<p><strong>docker exec -it redis-stack redis-cli MODULE LIST<\/strong><\/p>\n\n\n\n<p>You should see search, ReJSON, timeseries, and bf listed. If you see an empty list, the container is still starting \u2014 wait 10 seconds and try again.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Storing JSON Documents with RedisJSON<\/strong><\/h2>\n\n\n\n<p>RedisJSON lets you store, update, and query JSON documents natively in Redis without serialising them to strings first.<\/p>\n\n\n\n<p>Store a product document:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>JSON.SET product:1001 $ '{\"name\": \"Wireless Keyboard\", \"category\": \"electronics\", \"price\": 1299, \"stock\": 45}'<\/code><\/pre>\n\n\n\n<p>Read the whole document:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>JSON.GET product:1001 $\n<\/code><\/pre>\n\n\n\n<p>Update just one field without reading the whole document:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>JSON.SET product:1001 $.price 1199\n<\/code><\/pre>\n\n\n\n<p>Append to a nested array:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>JSON.ARRAPPEND product:1001 $.tags '\"sale\"' '\"bestseller\"'<\/code><\/pre>\n\n\n\n<p>This granular update capability is one of the key advantages RedisJSON has over storing JSON as a plain string: you pay only for what you touch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Indexing and Searching with RediSearch<\/strong><\/h2>\n\n\n\n<p>RediSearch adds full-text search, secondary indexing, aggregation, and vector similarity search to Redis. You can create indexes on existing Redis hashes and JSON documents and query them with a rich query language without changing your data model.<\/p>\n\n\n\n<p>Create an index over your product JSON documents:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FT.CREATE idx:products ON JSON PREFIX 1 product:\n  SCHEMA $.name AS name TEXT WEIGHT 2.0\n         $.category AS category TAG\n         $.price AS price NUMERIC SORTABLE\n         $.stock AS stock NUMERIC\n<\/code><\/pre>\n\n\n\n<p>The index automatically picks up every key that starts with <strong>product:<\/strong> and keeps itself updated as documents change.<\/p>\n\n\n\n<p>Search for products:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FT.SEARCH idx:products \"keyboard\" FILTER price 500 2000 SORTBY price ASC LIMIT 0 10\n<\/code><\/pre>\n\n\n\n<p>This finds every product matching &#8220;keyboard&#8221; with a price between 500 and 2000, sorted by price, in a single command. No JOIN, no separate query layer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Time-Series Data with RedisTimeSeries<\/strong><\/h2>\n\n\n\n<p>RedisTimeSeries is built for metrics, <a href=\"https:\/\/www.guvi.in\/blog\/what-is-iot\/\">IoT<\/a> sensor readings, and application performance data where you need efficient storage and fast aggregation over time ranges.<\/p>\n\n\n\n<p>Create a time series and add readings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TS.CREATE temp:sensor1 RETENTION 86400000 LABELS location bangalore type temperature\nTS.ADD temp:sensor1 * 34.2\nTS.ADD temp:sensor1 * 35.1\nTS.ADD temp:sensor1 * 33.8\n<\/code><\/pre>\n\n\n\n<p>The asterisk uses the current timestamp automatically. The <strong>RETENTION<\/strong> value is in milliseconds, so 86400000 keeps 24 hours of data and auto-deletes older readings.<\/p>\n\n\n\n<p>Query the average over the last hour:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TS.RANGE temp:sensor1 -1 + AGGREGATION avg 3600000\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Connecting with Python<\/strong><\/h2>\n\n\n\n<p>Install the official Python client:<\/p>\n\n\n\n<p><strong>pip install redis<\/strong><\/p>\n\n\n\n<p>Connect and use all Redis Stack features:<\/p>\n\n\n\n<p><strong>Python&nbsp;<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import redis\nimport json\n\nr = redis.Redis(host='localhost', port=6379, decode_responses=True)\n\nr.json().set('product:2001', '$', {\n    'name': 'Mechanical Keyboard',\n    'category': 'electronics',\n    'price': 3499,\n    'stock': 12\n})\n\nr.ft('idx:products').create_index(&#91;\n    r.ft.TextField('$.name', as_name='name', weight=2.0),\n    r.ft.TagField('$.category', as_name='category'),\n    r.ft.NumericField('$.price', as_name='price', sortable=True)\n], definition=r.ft.IndexDefinition(prefix=&#91;'product:'], index_type=r.ft.IndexType.JSON))\n\nresults = r.ft('idx:products').search('mechanical')\nfor doc in results.docs:\n    print(doc.name, doc.price)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>When to Use Redis Stack<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Use Case<\/strong><\/td><td><strong>Why Redis Stack<\/strong><\/td><\/tr><tr><td>Product catalogue search<\/td><td>RediSearch replaces Elasticsearch for most mid-scale use cases<\/td><\/tr><tr><td>Session store plus user profile<\/td><td>RedisJSON stores rich user data alongside standard Redis session keys<\/td><\/tr><tr><td>IoT dashboard<\/td><td>RedisTimeSeries aggregates sensor data and serves dashboards in milliseconds<\/td><\/tr><tr><td>Recommendation feed<\/td><td>Combine RedisJSON for item data with RediSearch vector search for similarity<\/td><\/tr><tr><td>Fraud detection<\/td><td>RedisBloom handles large-scale membership checks with minimal memory<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div style=\"background-color: #099f4e; border: 3px solid #110053; border-radius: 12px; padding: 18px 22px; color: #FFFFFF; font-size: 18px; font-family: Montserrat, Helvetica, sans-serif; line-height: 1.6; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); max-width: 750px; margin: 22px auto;\">\n  <h3 style=\"margin-top: 0; font-size: 22px; font-weight: 700; color: #ffffff;\">\ud83d\udca1 Did You Know?<\/h3>\n  <ul style=\"padding-left: 20px; margin: 10px 0;\">\n    <li>RediSearch is included in Redis Stack and automatically indexes matching existing and new hashes and JSON documents, making it non-intrusive to add to an existing Redis deployment. This means you can add search to an existing Redis-backed application without migrating any data or changing your write path.<\/li>\n  <\/ul>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Common Mistakes to Avoid<\/strong><\/h2>\n\n\n\n<ul>\n<li><strong>Using plain Redis when you need Redis Stack.<\/strong> If your application stores JSON as serialised strings in plain Redis and you need to query fields inside those documents, you are doing work RedisJSON handles natively. Switch to Redis Stack and your query code becomes simpler and faster simultaneously.<\/li>\n\n\n\n<li><strong>Not specifying a PREFIX on FT.CREATE.<\/strong> Without a prefix, RediSearch scans every key in Redis to build the index, including your session keys, rate limit counters, and caches. Always scope your index to a specific key prefix that matches only the documents you want indexed.<\/li>\n\n\n\n<li><strong>Forgetting RETENTION on time series.<\/strong> Without a retention policy, RedisTimeSeries keeps data forever. For high-frequency sensor data this consumes memory rapidly. Always set a RETENTION value in milliseconds when creating any time series key.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>This Redis Stack tutorial covered the full beginner path: running with Docker, storing JSON documents with RedisJSON, creating a search index with RediSearch, aggregating time-series data with RedisTimeSeries, and connecting from Python. Redis Stack gives you a mature, battle-tested foundation for search, analytics, and structured data storage without adding new databases to your architecture.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>FAQs<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1782741197082\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>1. What is Redis Stack?<\/strong>\u00a0<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Redis Stack is an extension of Redis that bundles RediSearch, RedisJSON, RedisTimeSeries, and RedisBloom into a single Docker image, adding full-text search, native JSON storage, time-series analytics, and probabilistic data structures to standard Redis.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782741214980\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>2. Is Redis Stack free?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes for local use. Redis Stack Server is licensed under the Redis Source Available License 2.0 (RSALv2) or the Server Side Public License (SSPL). Redis Cloud also offers a managed free tier with 30 MB included.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782741233121\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>3. What is the difference between Redis and Redis Stack?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Plain Redis handles caching, pub\/sub, and basic data structures. Redis Stack adds full-text search, JSON document storage, time-series data, and probabilistic filters on top of the same in-memory engine.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782741309222\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>4. Do I need to install the modules separately?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>No. The <strong>redis\/redis-stack<\/strong> Docker image ships with all four modules pre-installed and loaded automatically on startup.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782741324929\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>5. Can I use Redis Stack with Python?<\/strong>\u00a0<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes. The standard <strong>redis-py<\/strong> package supports all Redis Stack modules through dedicated command groups like <strong>r.json()<\/strong>, <strong>r.ft()<\/strong>, and <strong>r.ts()<\/strong> with no additional drivers required.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Plain Redis is the fastest in-memory cache in the world. But Redis Stack takes that foundation and adds full-text search, native JSON support, time-series storage, and probabilistic data structures like bloom filters, all accessible through the same Redis connection your app already uses. This Redis Stack tutorial shows you how to run it with Docker, [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":121198,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[325,294],"tags":[],"views":"38","authorinfo":{"name":"Jebasta","url":"https:\/\/www.guvi.in\/blog\/author\/jebasta\/"},"thumbnailURL":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/07\/Redis-Stack-300x116.webp","_links":{"self":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/119564"}],"collection":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/comments?post=119564"}],"version-history":[{"count":3,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/119564\/revisions"}],"predecessor-version":[{"id":121202,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/119564\/revisions\/121202"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media\/121198"}],"wp:attachment":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media?parent=119564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/categories?post=119564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/tags?post=119564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}