Hi.
As I understand we are using HSET in RS 2.0 to set some doc into the index. What if we have multiple indexes which can have same fields names, is there a way to specific index name on HSET?
Hey @botzill , the idea on RediSearch 2.0 is that the index is following your hashes base of key prefix or filter. So if you want to split hashes to different indexes you just need to prefix them and define the indexes to follow the relevant prefix:
127.0.0.1:6379> FT.CREATE idx1 PREFIX 1 idx1: SCHEMA s TEXT
OK
127.0.0.1:6379> FT.CREATE idx2 PREFIX 1 idx2: SCHEMA s TEXT
OK
127.0.0.1:6379> hset idx1:doc1 s foo
(integer) 1
127.0.0.1:6379> hset idx2:doc1 s bar
(integer) 1
127.0.0.1:6379> FT.SEARCH idx1 *
1) (integer) 1
2) "idx1:doc1"
3) 1) "s"
2) "foo"
127.0.0.1:6379> FT.SEARCH idx2 *
1) (integer) 1
2) "idx2:doc1"
3) 1) "s"
2) "bar"
Thx, @MeirShpilraien, now is clear the concept.
What about {count} in PREFIX, don't really understand that from docs.
The idea is that you can specify multiple prefixes for an index so the count is the number of prefixes you are going to give.
I see, not really aware of the internal structure, but can't that be determined automatically? Like if we add prefixes by space, that can be used to determine them.
Its better defined this way cause then you can also put RediSearch saved words as a prefix (like schema)
Most helpful comment
Hey @botzill , the idea on RediSearch 2.0 is that the index is following your hashes base of key prefix or filter. So if you want to split hashes to different indexes you just need to prefix them and define the indexes to follow the relevant prefix: