Skip to content

Tutorials for Vector Search and HFE #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
df0e45a
Tutorials for Vector Search and HFE
ViktarStarastsenka Jun 10, 2025
fbaa0b1
Changing the AI tutorial
ViktarStarastsenka Jun 10, 2025
1da2158
Updating the tutorial for AI chatbot
ViktarStarastsenka Jun 10, 2025
849c951
Updating the AI assistand guide
ViktarStarastsenka Jun 11, 2025
ab887f1
Updating tutorial for recommendations
ViktarStarastsenka Jun 11, 2025
455384c
Updating a tutorial for recommendations
ViktarStarastsenka Jun 11, 2025
ff4a673
Update ai_assistant.md
ViktarStarastsenka Jul 1, 2025
cecbf6b
Update ai_assistant.md
ViktarStarastsenka Jul 4, 2025
780ea22
Update ai_assistant.md
ViktarStarastsenka Jul 4, 2025
b093e1c
Update ai_assistant.md
ViktarStarastsenka Jul 7, 2025
6802a71
Update ai_assistant.md
ViktarStarastsenka Jul 7, 2025
1531361
Update src/manifest.json
ViktarStarastsenka Jul 22, 2025
df83936
Update vectors-adv-hash.md
ViktarStarastsenka Jul 24, 2025
1b2d10a
Delete src/vss/vectors-basic.md
ViktarStarastsenka Jul 24, 2025
73f2a4b
Rename vectors-adv-hash.md to vector_bikes.md
ViktarStarastsenka Jul 24, 2025
93c3159
Update manifest.json
ViktarStarastsenka Jul 24, 2025
936a5b7
Rename vector_bikes.md to e-commerce-discovery.md
ViktarStarastsenka Jul 24, 2025
8366183
Create personalized_recommendations.md
ViktarStarastsenka Jul 24, 2025
2662848
Create ai_assistant.md
ViktarStarastsenka Jul 24, 2025
9e63170
Update manifest.json
ViktarStarastsenka Jul 24, 2025
57635ee
Update hashes.md
ViktarStarastsenka Jul 24, 2025
7aad062
Mentioning Redis 8 instead of Redis Stack
ViktarStarastsenka Jul 24, 2025
6e50a31
Mentioning Redis 8 instead of Redis Stack
ViktarStarastsenka Jul 24, 2025
c920ba0
Mentioning JSON data structure instead of Redis Stack
ViktarStarastsenka Jul 24, 2025
0b1ee92
Mentioning Redis 8 instead of Redis Stack
ViktarStarastsenka Jul 24, 2025
16f8cc0
Update more-adv-jsonpath.md
ViktarStarastsenka Jul 24, 2025
7a55741
Mentioning RQE and Redis 8 instead of Redis Stack
ViktarStarastsenka Jul 24, 2025
884b9ad
Update intro.md
ViktarStarastsenka Jul 24, 2025
0a9e338
Update intro.md
ViktarStarastsenka Jul 24, 2025
87294f5
Mentioning Redis 8 instead of Redis Stack
ViktarStarastsenka Jul 24, 2025
9e391cc
Update manifest.json
ViktarStarastsenka Jul 24, 2025
9fee519
Update intro.md
ViktarStarastsenka Jul 29, 2025
2611077
Update intro.md
ViktarStarastsenka Jul 29, 2025
40b59fa
Update intro.md
ViktarStarastsenka Jul 29, 2025
3e46366
Update intro.md
ViktarStarastsenka Jul 29, 2025
2822d9a
Update ai_assistant.md
ViktarStarastsenka Jul 29, 2025
9d7c2fe
Apply suggestions from code review
ViktarStarastsenka Jul 29, 2025
81b9d5c
Update ai_assistant.md
ViktarStarastsenka Jul 29, 2025
432a241
Delete src/uc/ai_assistant.md
ViktarStarastsenka Jul 29, 2025
5c4f1af
Delete src/vss/ai_assistant.md
ViktarStarastsenka Jul 29, 2025
fbf3e89
Delete src/uc/personalized_recommendations.md
ViktarStarastsenka Jul 29, 2025
22934e3
Update personalized_recommendations.md
ViktarStarastsenka Jul 29, 2025
8d4108d
Create ai_assistant.md
ViktarStarastsenka Jul 29, 2025
f0d0b8b
Update personalized_recommendations.md
ViktarStarastsenka Jul 29, 2025
e2d6860
Update manifest.json
ViktarStarastsenka Jul 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/ds/hashes.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ HINCRBY bike:1 price 100
HINCRBY bike:1 price -100
```

New in [Redis Community Edition version 7.4](https://hub.docker.com/layers/redis/redis-stack/7.4.0-v0/images/sha256-3e3c86603a81712d1311bc619ad124de15b2dca2b50722f23a4502b4d4054ba8) is the ability set the expiration time or the remaining time-to-live (TTL) for individual hash fields. This is called hash field expiration (HFE). HFE works just like [key expiration](https://redis.io/docs/latest/develop/use/keyspace/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials#key-expiration) and includes the following commands:
Available in [Redis 8](https://hub.docker.com/layers/library/redis/8.0.3/images/sha256-426e6823fb1778e8c49f327f9e5af00e505a7fca726ffe11b7930eb1d99ef5fd) is the ability set the expiration time or the remaining time-to-live (TTL) for individual hash fields. This is called hash field expiration (HFE). HFE works just like [key expiration](https://redis.io/docs/latest/develop/use/keyspace/?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials#key-expiration) and includes the following commands:

- `hexpire` - set an expiration (time-to-live or TTL) in seconds on a hash key's field(s).
- `hexpireat` - set a TTL as an absolute Unix timestamp (seconds since Unix epoch) on a hash key's field(s).
Expand Down Expand Up @@ -80,6 +80,7 @@ HGETALL hash
```
### Resources

- A tutorial on building an [AI assistant](redisinsight:_?tutorialId=ai_assistant) using hash field expiration.
- Hash type [reference page](https://redis.io/docs/data-types/hashes?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials).
- Entire set of [Redis hash commands](https://redis.io/commands/?group=hash?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials).
- Check out [Get started with Redis](https://university.redis.io/learningpath/14q8m6gilfwltm?utm_source=redisinsight&utm_medium=main&utm_campaign=tutorials) learning path on Redis University for an introduction to working with all core data structures in Redis.
4 changes: 2 additions & 2 deletions src/ds/json/adv-jsonpath.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[JSONPath](https://goessner.net/articles/JsonPath/) expressions help you access specific elements within a JSON document, which is similar to how XPATH works for XML documents.
JSONPath support was added to Redis Stack in version 2.0.
JSONPath support was added to the JSON data structure in version 2.0.
Before that, [a legacy form of pathing](https://redis.io/docs/data-types/json/path/#legacy-path-syntax) was supported.
Only JSONPath will be discussed in this tutorial.

Expand Down Expand Up @@ -133,7 +133,7 @@ JSON.GET obj2 $.b[0]
JSON.GET obj2 $.*[0]
```

Redis Stack also supports slice syntax for arrays: `[start:`end`:`step`]`, where `start`, `end`, and `step` are indexes.
The JSON data structure also supports slice syntax for arrays: `[start:`end`:`step`]`, where `start`, `end`, and `step` are indexes.
If the current node is an array, an array containing elements extracted from an array are returned, based on a `start` index, an `end` index, and a `step` index.
Array indexes are zero-based; the first element is index 0. Start Index is inclusive; End index is not inclusive.
The following rules apply:
Expand Down
6 changes: 3 additions & 3 deletions src/ds/json/intro.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The JSON capability of Redis Stack provides JavaScript Object Notation (JSON) support for Redis, which allows Redis to function as a document database.
The JSON capability provides JavaScript Object Notation (JSON) support for Redis, which allows Redis to function as a document database.
It lets you store, update, and retrieve JSON values in a Redis database, similar to any other Redis data type. Redis JSON also works seamlessly with Search and Query to let you index and query JSON documents.

Primary features include:
Expand All @@ -10,8 +10,8 @@ Primary features include:

### Prerequisites

[Redis Stack](https://redis.io/downloads/?utm_source=redisinsight&utm_medium=app&utm_campaign=json_tutorial) >=7.2.0-v7 \
[Redis 8](https://hub.docker.com/layers/library/redis/8.0.3/images/sha256-426e6823fb1778e8c49f327f9e5af00e505a7fca726ffe11b7930eb1d99ef5fd) or higher \
OR \
[RedisJSON](https://github.com/RedisJSON/RedisJSON/) >=2.6.8 \
OR \
A free Redis Stack instance on [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=app&utm_campaign=json_tutorial).
A free Redis instance on [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=app&utm_campaign=json_tutorial).
2 changes: 1 addition & 1 deletion src/ds/json/more-adv-jsonpath.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ JSON.GET obj2 '$.a[?(@!="a")]' // [1,2,3,"b","c",false,true,["a",1],{"a":1},{"b"
#### Relational use cases using regular expression with the `=~` operator

**Note**:
> Redis Stack uses [Rust regular expressions syntax](https://docs.rs/regex/latest/regex/#syntax). Invalid regular expressions are not evaluated.
> The JSON data structure uses [Rust regular expressions syntax](https://docs.rs/regex/latest/regex/#syntax). Invalid regular expressions are not evaluated.

There are two cases:

Expand Down
4 changes: 2 additions & 2 deletions src/ds/prob/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ The following data structures trade perfect accuracy for extreme memory efficien

### Prerequisites

[Redis Stack Server](https://redis.io/downloads/?utm_source=redisinsight&utm_medium=app&utm_campaign=probabilistic_tutorial) >=7.2.0-v7 \
[Redis 8](https://hub.docker.com/layers/library/redis/8.0.3/images/sha256-426e6823fb1778e8c49f327f9e5af00e505a7fca726ffe11b7930eb1d99ef5fd) or higher \
OR \
[RedisBloom](https://oss.redis.com/redisbloom/) >=2.6.10 \
OR \
A free Redis Stack instance on [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=app&utm_campaign=probabilistic_tutorial).
A free Redis instance on [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=app&utm_campaign=probabilistic_tutorial).
4 changes: 2 additions & 2 deletions src/ds/ts/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ You can ingest and query millions of samples and events at the speed of Redis.

### Prerequisites

[Redis Stack Server](https://redis.io/downloads/?utm_source=redisinsight&utm_medium=app&utm_campaign=timeseries_tutorial) >=7.2.0-v7 \
[Redis 8](https://hub.docker.com/layers/library/redis/8.0.3/images/sha256-426e6823fb1778e8c49f327f9e5af00e505a7fca726ffe11b7930eb1d99ef5fd) or higher \
OR \
[RedisTimeSeries](https://oss.redis.com/redistimeseries/) >=1.10.11 \
OR \
A free Redis Stack instance on [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=app&utm_campaign=timeseries_tutorial).
A free Redis instance on [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=app&utm_campaign=timeseries_tutorial).
247 changes: 129 additions & 118 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,135 @@
}
]
},
{
"type": "group",
"id": "vss",
"label": "Vector search examples",
"args": {
"initialIsOpen": false
},
"children": [
{
"type": "internal-link",
"id": "vss-intro",
"label": "Introduction",
"summary": "Understand how to use Redis as a vector database.",
"args": {
"path": "/vss/intro.md"
}
},
{
"type": "internal-link",
"id": "e-commerce-discovery",
"label": "E-commerce Discovery",
"summary": "Find products by meaning, not just keywords.",
"args": {
"path": "/vss/e-commerce-discovery.md"
}
},
{
"type": "internal-link",
"id": "personalized_recommendations",
"label": "Building personalized recommendations",
"summary": "Suggest movies based on the true meaning of plots or themes.",
"args": {
"path": "/uc/personalized_recommendations.md"
}
},
{
"type": "internal-link",
"id": "ai_assistant",
"label": "Creating an AI Assistant",
"summary": "An assistant that temporarily remembers conversations and understands their meaning.",
"args": {
"path": "/uc/ai_assistant.md"
}
},
{
"type": "internal-link",
"id": "vss-learn-more",
"label": "Learn more",
"args": {
"path": "/vss/learn-more.md"
}
}
]
},
{
"type": "group",
"id": "sq",
"label": "How to query your data",
"args": {
"initialIsOpen": false
},
"children": [
{
"type": "internal-link",
"id": "sq-intro",
"label": "Introduction",
"summary": "Try real-time searching and perform complex structured queries without compromising database performance.",
"args": {
"path": "/sq/intro.md"
}
},
{
"type": "internal-link",
"id": "sq-exact-match",
"label": "Exact match",
"args": {
"path": "/sq/exact-match.md"
}
},
{
"type": "internal-link",
"id": "sq-full-text",
"label": "Full-text search",
"args": {
"path": "/sq/full-text.md"
}
},
{
"type": "internal-link",
"id": "sq-range",
"label": "Range queries",
"args": {
"path": "/sq/range.md"
}
},
{
"type": "internal-link",
"id": "sq-geospatial",
"label": "Geospatial queries",
"args": {
"path": "/sq/geospatial.md"
}
},
{
"type": "internal-link",
"id": "sq-combined",
"label": "Combined queries",
"args": {
"path": "/sq/combined.md"
}
},
{
"type": "internal-link",
"id": "sq-aggregations",
"label": "Analytic and transformative queries",
"args": {
"path": "/sq/aggregations.md"
}
},
{
"type": "internal-link",
"id": "sq-learn-more",
"label": "Learn more",
"args": {
"path": "/sq/learn-more.md"
}
}
]
},
{
"type": "group",
"id": "ds",
Expand Down Expand Up @@ -308,124 +437,6 @@
]
}
]
},
{
"type": "group",
"id": "sq",
"label": "How to query your data",
"args": {
"initialIsOpen": false
},
"children": [
{
"type": "internal-link",
"id": "sq-intro",
"label": "Introduction",
"summary": "Try real-time searching and perform complex structured queries without compromising the database performance.",
"args": {
"path": "/sq/intro.md"
}
},
{
"type": "internal-link",
"id": "sq-exact-match",
"label": "Exact match",
"args": {
"path": "/sq/exact-match.md"
}
},
{
"type": "internal-link",
"id": "sq-full-text",
"label": "Full-text search",
"args": {
"path": "/sq/full-text.md"
}
},
{
"type": "internal-link",
"id": "sq-range",
"label": "Range queries",
"args": {
"path": "/sq/range.md"
}
},
{
"type": "internal-link",
"id": "sq-geospatial",
"label": "Geospatial queries",
"args": {
"path": "/sq/geospatial.md"
}
},
{
"type": "internal-link",
"id": "sq-combined",
"label": "Combined queries",
"args": {
"path": "/sq/combined.md"
}
},
{
"type": "internal-link",
"id": "sq-aggregations",
"label": "Analytic and transformative queries",
"args": {
"path": "/sq/aggregations.md"
}
},
{
"type": "internal-link",
"id": "sq-learn-more",
"label": "Learn more",
"args": {
"path": "/sq/learn-more.md"
}
}
]
},
{
"type": "group",
"id": "vss",
"label": "Vector search explained",
"args": {
"initialIsOpen": false
},
"children": [
{
"type": "internal-link",
"id": "vss-intro",
"label": "Introduction",
"summary": "Understand how to use Redis as a vector database.",
"args": {
"path": "/vss/intro.md"
}
},
{
"type": "internal-link",
"id": "vss-vectors-basic",
"label": "Vector search (basic)",
"args": {
"path": "/vss/vectors-basic.md"
}
},
{
"type": "internal-link",
"id": "vss-vectors-adv-hash",
"label": "Vector search (advanced)",
"args": {
"path": "/vss/vectors-adv-hash.md"
}
},
{
"type": "internal-link",
"id": "vss-learn-more",
"label": "Learn more",
"args": {
"path": "/vss/learn-more.md"
}
}
]
}
]
}
4 changes: 2 additions & 2 deletions src/sq/geospatial.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Redis Stack's geospatial feature allows you to query for data associated with geographic locations. You can either query for locations within a specific radius or based on geometric shapes, such as polygons. A polygon shape could, for instance, represent a lake or the layout of a building.
Redis Query Engine's geospatial feature allows you to query for data associated with geographic locations. You can either query for locations within a specific radius or based on geometric shapes, such as polygons. A polygon shape could, for instance, represent a lake or the layout of a building.

The examples in this article use the following schema:

Expand All @@ -9,7 +9,7 @@ The examples in this article use the following schema:


**Note**:
> Redis Stack version 7.2.0 or higher is required to use the `GEOSHAPE` field type.
> We recommend using Redis 8 or higher to use the `GEOSHAPE` field type.

```redis:[run_confirmation=true] Create the bike shop idx:bicycle
FT.CREATE
Expand Down
8 changes: 4 additions & 4 deletions src/sq/intro.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Redis Stack offers an enhanced Redis experience via the following Redis Query Engine features:
The Redis Query Engine offers an enhanced Redis experience using the following search and query features:

- A rich query language
- Incremental indexing on JSON and hash documents
Expand All @@ -7,7 +7,7 @@ Redis Stack offers an enhanced Redis experience via the following Redis Query En
- Geospatial queries
- Aggregations

The Redis Query Engine features of Redis Stack allow you to use Redis as a:
The Redis Query Engine features you to use Redis as a:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Redis Query Engine features you to use Redis as a:
The Redis Query Engine features allow you to use Redis as a:


- Document database
- Vector database
Expand All @@ -16,8 +16,8 @@ The Redis Query Engine features of Redis Stack allow you to use Redis as a:

### Prerequisites

[Redis Stack](https://redis.io/downloads/?utm_source=redisinsight&utm_medium=app&utm_campaign=query_engine_tutorial) >=7.4.0-v0 \
[Redis 8](https://hub.docker.com/layers/library/redis/8.0.3/images/sha256-426e6823fb1778e8c49f327f9e5af00e505a7fca726ffe11b7930eb1d99ef5fd) or higher \
OR \
[Redis Query Engine](https://github.com/RediSearch/RediSearch/) >=2.10.5 \
OR \
A free Redis Stack instance on [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=app&utm_campaign=query_engine_tutorial).
A free Redis instance on [Redis Cloud](https://redis.io/try-free/?utm_source=redisinsight&utm_medium=app&utm_campaign=redis_query_engine_tutorial).
Loading