Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Index Alias management capabilities #162

Open
pierrelambert opened this issue Jun 14, 2024 · 4 comments
Open

Add Index Alias management capabilities #162

pierrelambert opened this issue Jun 14, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@pierrelambert
Copy link

The Alias capability of Indexes with ft.aliasadd, ft.aliasdel, FT.ALIASUPDATE permits agility in making index and apps evolving.
Would be nice to be able to handle this at SearchIndex level directly.

@tylerhutcherson tylerhutcherson added the enhancement New feature or request label Jun 18, 2024
@tylerhutcherson tylerhutcherson self-assigned this Jun 18, 2024
@tylerhutcherson
Copy link
Collaborator

@pierrelambert 100% Agreed - this is planned for the 0.3.0 release. Though it gets tricky without the ability to list which aliases are used per index.

Ideally the index alias would be a schema property like this:

index:
  name: users_v1
  prefix: user
  alias: users

fields:
    - name: user
      type: tag
    - name: credit_score
      type: tag

So then the alias would get added transparently as they call index.create(...)

And then a new command to update the alias:

index.update_alias("new_alias_name")

However, given we can't trace the state of the index<>alias relationships... this is pretty much impossible without footguns all over the place.

@bsbodden curious on your take?

@pierrelambert
Copy link
Author

Define / Set an alias to an index is must have.
Change the index an alias is referring to (FT.ALIASUPDATE) is must have too

@bsbodden
Copy link
Collaborator

I agree with @pierrelambert that this is a must have for prod environments, since the index to alias relationship is a one-to-many we could:

  • take a list of strings under aliases or a single string under alias
  • We can use FT.INFO alias to determine if the alias exists and also use index_name to verify that it is attached to the current index
  • Keep/manage our own per-index Redis SET of aliases (something like [index_name]_ALIASES) until a command to retrieve aliases is provided (FT._LIST_ALIASES index)
  • Using a set this way is a very common pattern in Redis libraries, we just need to make sure we clean up after ourselves when/if the index is deleted

@tylerhutcherson
Copy link
Collaborator

I like this approach. I’ve been hesitant to create extra “metadata” generated by the library… but I think I agree that usability and functionality is most important here. We need alias support for sure.

I’ll start working on a more detailed write up for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants