[rank_math_breadcrumb]
INTRODUCTION
产品介绍
索引与查询
Search and query
JSON存储
JSON
Active-Active多活架构
Active-Active
自动分层
Auto-tiering
向量搜索
Vector Search
依托开源Redis作为内核,由Redis官方的核心团队构建,提供企业级的高性能缓存解决方案,满足您的扩展需求。 ——由Redis官方开发并支持的企业级缓存方案,您的通用数据平台
# Create a new session and store it as a JSON document
> JSON.SET session:12345 . ‘{“user_id”: 1001, “login_time”: “2024-02-27T10:00:00Z”, “data”: {“last_page_visited”: “/home”, “preferences”: {“theme”: “dark”}}}’
“OK”
# Fetch the entire session
> JSON.GET session:12345
“{\”user_id\”:1001,\”login_time\”:\”2024-02-27T10:00:00Z\”,\”data\”:{\”last_page_visited\”:\”/home\”,\”preferences\”:{\”theme\”:\”dark\”}}}”
# Fetch a specific part of the session
> JSON.GET session:12345 .data.preferences
“{\”theme\”:\”dark\”}”
# Update a field within the session
> JSON.SET session:12345 .data.last_page_visited ‘”/settings”‘
“OK”
# Delete a field within the session
> JSON.DEL session:12345 .data.preferences
(integer) 1
# Delete a session
> DEL session:12345
(integer) 1
先进、实时向量检索能力,轻松构建您的文档语义搜索、推荐系统等进阶功能,赋能AI应用的智能化与响应速度。——挖掘大模型应用的无限可能,语义缓存、RAG(检索增强生成)等多种用例,构建您的私有大模型。
# Create a vector index using the HNSW algorithm, 768 dimension length, and inner product distance metric
> FT.CREATE idx-videos ON HASH PREFIX 1 video: SCHEMA content_vector VECTOR HNSW 6 TYPE FLOAT32 DIM 768 DISTANCE_METRIC IP content TEXT metadata TEXT
# Add a video vector with metadata
> HSET video:0 content_vector “\xa4q\t=\xc1\xdes\xbdZ$<\xbd\xd5\xc1\x99 FT.SEARCH idx-videos “* => [KNN 3 @content_vector $vector AS vector_score]” RETURN 3 metadata content vector_score SORTBY vector_score LIMIT 0 3 PARAMS 2 vector “\b[\xb7;\x81\x12\x9c\xbc\xc6!…\xfe<” DIALECT 2
NoSQL数据库的行业领先者,Redis企业版帮助您构建快速、可靠的持续,最高提供高达99.999%的高可用性。——异地多活,99.999%的高可用,极速存取,帮助您构建快速、可靠的应用。
Create an index on “users:*”
> FT.CREATE user-idx ON JSON PREFIX 1 users: SCHEMA $.user.name AS name TEXT $.user.hobbies AS hobbies TAG $.user.age as age NUMERIC
“OK”
# Add a JSON document to be indexed
> JSON.SET users:1 $ ‘{“user”:{“name”:”John Smith”,”hobbies”:[“sports”,”computers”],”age”:23}}’
“OK”
# Search all user documents with name “John”
> FT.SEARCH user-idx ‘@name:(John)’
1) “1”
2) “users:1”
3) 1) “$”
2) “{\”user\”:{\”name\”:\”John Smith\”,\”hobbies\”:[\”sports\”,\”computers\”],\”age\”:23}}”
# Search for users named “John” with hobbies “sports” or “writing” and age between 20 and 30
> FT.SEARCH user-idx ‘@name:(John) @hobbies:{sports | writing} @age:[20 30]’
1) “1”
2) “users:1”
3) 1) “$” 2) “{\”user\”:{\”name\”:\”John Smith\”,\”hobbies\”:[\”sports\”,\”computers\”],\”age\”:23}}”