In both HashRepository.CreateAndAliasIndex and JSONRepository.CreateAndAliasIndex the error message returned from the FT.INFO command is matched against the string "Unknown index name" when verifying whether the index exists.
At least in Redis 8 OSS this is not the message returned in this case (it's "no such index"), causing the operation to fail on DBs in which the index was not yet created.
This approach is fragile. Instead we can use FT._LIST to list the indexes and check there whether any indexes exist matching the pattern (the alias won't show up there). There is also an opportunity here to share code between HashRepository and JSONRepository (the functions in both are almost identical).
I'll try to have a PR for this early next week.
In both
HashRepository.CreateAndAliasIndexandJSONRepository.CreateAndAliasIndexthe error message returned from theFT.INFOcommand is matched against the string"Unknown index name"when verifying whether the index exists.At least in Redis 8 OSS this is not the message returned in this case (it's
"no such index"), causing the operation to fail on DBs in which the index was not yet created.This approach is fragile. Instead we can use
FT._LISTto list the indexes and check there whether any indexes exist matching the pattern (the alias won't show up there). There is also an opportunity here to share code betweenHashRepositoryandJSONRepository(the functions in both are almost identical).I'll try to have a PR for this early next week.