redisredisearch

How to use Redisearch from Redis-cli to find an exact number?


I have a set of data like this :

127.0.0.1:6379> json.set a:1 . '{"name":"chloe", "age":26}'
OK
127.0.0.1:6379> json.set a:2 . '{"name":"shan", "age":38}'
OK
127.0.0.1:6379> json.set a:3 . '{"name":"wala", "age":14}'
OK
127.0.0.1:6379> json.set a:4 . '{"name":"Aida", "age":18}'

and I wish to find the one with the age of 14 with the following command and yet I fail.

ft.search idx "@age:(14)"

How can I find the data with exact age of 14?


Solution

  • Try numeric range in following way:

    ft.search idx "@age:[14 14]"