Skip to content

Instantly share code, notes, and snippets.

1) 1) (integer) 2
2) "doc:2"
3) 1) "text"
2) "hallo world"
4) "doc:1"
5) 1) "text"
2) "hello world"
redis.cloud:6379> FT.SEARCH myIdx "@title:foo"
1) (integer) 1
2) "myDoc"
3) 1) "$"
2) "{\"title\":\"foo\",\"content\":\"bar\"}"
redis.cloud:6379> FT.AGGREGATE myIdx '*' LOAD 6 $.user.hp AS hp $.user.dmg AS dmg APPLY '@hp - @dmg' AS points
1) (integer) 1
2) 1) "point"
2) "850"
redis.cloud:6379> FT.CREATE myIdx ON HASH SCHEMA category TAG
OK
redis.cloud:6379> FT.SEARCH myIdx "@category:{foo}"
1) (integer) 1
2) "myDoc"
3) 1) "category"
2) "foo,bar,hello world"
redis.cloud:6379> FT.SEARCH myIdx "@category:{foo} @cat_txt:(hello)"
1) (integer) 1
2) "myDoc"
3) 1) "category"
2) "foo,bar,hello world"
redis.cloud:6379> HSET doc:1 text "hello world"
(integer) 1
redis.cloud:6379> HSET doc:2 text "hallo world"
(integer) 1
redis.cloud:6379> FT.CREATE idx ON HASH SCHEMA text TEXT
OK
redis.cloud:6379> HSET myDoc category "foo,bar,hello world"
(integer) 1
redis.cloud:6379> HSET myDoc category "foo,bar,hello world"
(integer) 1
redis.cloud:6379> FT.CREATE myIdx ON HASH SCHEMA category TAG category
AS cat_txt TEXT
OK
redis.cloud:6379> SET myDoc '{"colors": ["green"]}'
OK