rediSearch Cannot create index on db != 0?

1.4k views Asked by At

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?

2

There are 2 answers

0
Simon Prickett On BEST ANSWER

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.

0
Артём On

Yeah, here is the tooltip from Redis Insight:

" Avoid using logical databases.

Using logical databases is an anti-pattern that Salvatore Sanfilippo, the creator of Redis, once called the worst design mistake he ever made in Redis.

Although supported in Redis, logical databases are neither independent nor isolated in any other way and can freeze each other. Also, they are not supported by any clustering system (open source or Redis Enterprise clustering).

If you need a multi-tenant environment, try Redis Cloud, where each tenant has its own Redis database endpoint which is completely isolated from the other Redis databases."