I have installed the rediSearch module for an application, but I am getting the error Cannot create index on db != 0 do you know what it means?
Asked
Active
Viewed 962 times
2
-
Did you use the SELECT command? – Lior Kogan May 04 '22 at 19:10
-
RediSearch only works on database 0. We also consider SELECT to be an antipattern. – Simon Prickett May 04 '22 at 20:52
1 Answers
4
This is because RediSearch only operates on the default (0) database in Redis. Using numbered databases and the SELECT
command is somewhat of an anti-pattern in Redis and I'd always recommend instead namespacing your keys using something like ":" as a separator or using different instances of redis-server if you have different types of data storage needs that you're currently spreading out across different numbered databases in the same redis-server instance.

Simon Prickett
- 3,838
- 1
- 13
- 26