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

[Question] Adding new indexed properties to existing objects #333

Closed
Artonus opened this issue Mar 13, 2023 · 3 comments · Fixed by #366
Closed

[Question] Adding new indexed properties to existing objects #333

Artonus opened this issue Mar 13, 2023 · 3 comments · Fixed by #366

Comments

@Artonus
Copy link

Artonus commented Mar 13, 2023

Hi there!
I have a question regarding adding new Property to an already indexed object.

The problem I am facing is I am trying to query using the newly added property, but it doesn't find any objects.
I suspect that it is due to the indexes not being up to date.

What I have found is the Index Migration command in the docs.
https://github.com/redis/redis-om-dotnet/blob/main/docs/README.md#migrate
Unfortunately, I cannot find it in the MigrateIndex function in the IRedisConnection.

Will I dropping the index and recreating it manually will solve the problem?

Redis.OM Version: 0.4.0

@VagyokC4
Copy link

Will I dropping the index and recreating it manually will solve the problem?

It does yes. I too was looking for the migrate index, and had to just drop and re-create the index (which is less than ideal when moving to a prd env. as there is a time window when the results returned are in flux.)

Would be good to see the Migrate Index working.

@slorello89
Copy link
Member

Hi @Artonus - thanks for pointing that bit out - definitely doesn't belong in there - Migrate was something we considered adding a while ago (before Redis OM was released) but we elected not to because of the complexities involved, IIRC RediSearch has the ability to add but not delete fields with FT.ALTER - and without that crucial second bit it didn't make sense to implement. As @VagyokC4 points out you need to drop/create the index (again not ideal)

FYI @VagyokC4 - the FT.INFO command - see Connection.GetIndexInfo does return an Indexing property in it's result that does tell you whether the index is currently still in it's initial scan.

@VagyokC4
Copy link

FYI @VagyokC4 - the FT.INFO command - see Connection.GetIndexInfo does return an Indexing property in it's result that does tell you whether the index is currently still in it's initial scan.

@slorello89 That's interesting. So the issue I've noticed is if the index is building, while we query, we may return NULL when a document actually exists. Thinking out loud, if we create a flag to help manage this so that when set, and a query comes back with no results, we can have it internally check if index is creating and if so, wait until complete and try to query again? Maybe even a Func WaitForIndexCreation exposed that would allow me to (in real-time) determine if we should wait for index creation and try the query again, or continue on with the empty results.

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

Successfully merging a pull request may close this issue.

3 participants