Skip to content

Microshak/Redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RedisJSON

Spin up Redis

docker run -p 6379:6379 --name redis-redisjson redislabs/rejson:latest

Exec into Docker

 docker exec -it [container] bash

Start CLI

redis-cli

Query Data


JSON.SET foo . '"bar"'
JSON.GET foo
JSON.SET example . '[ true, { "answer": 42 }, null ]'
JSON.GET example
JSON.GET example [1].answer
JSON.DEL example [-1]
JSON.GET example


Bring it down

docker kill redis-redisjson

Redis Search

Spin up Resisearch

docker run -it --rm --name redis-search-2 -p 6379:6379  http://dockehub.com/redislabs/redisearch:2.0.0

import data

redis-cli -p 6379 < movie.redis

Create Index

redis-cli -p 6379 FT.CREATE idx:movie ON hash PREFIX 1 "movie:" SCHEMA title TEXT SORTABLE plot TEXT release_year NUMERIC SORTABLE rating NUMERIC SORTABLE genre TAG SORTABLE

"Fuzzy Search 'empre', for Empire"

redis-cli FT.SEARCH 'idx:movie' '%empre%'

All 'Action' Movie

redis-cli FT.SEARCH 'idx:movie' '@genre:{Action}'

"'Drama' from 2010 to 2020",

redis-cli FT.SEARCH 'idx:movie' '@genre:{Drama} @release_year:[2010 2020]

About

Examples of RedisJSON and RediSearch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published