Multiple model single index approach #514
Comments
I can't say I understand 100% what are you trying to do, but basically, for models, just call |
How do I update an index based on it's name? I mean if I want to update an index like users, how can I do something like tire.update_index 'users'. The index name may vary in my case. Is that possible? The index name isn't dynamically generated one in my case. |
Since you have a separate index for each model, just call Otherwise, use
I don't know what you mean. You're refering to dynamic index names by passing a block to |
Thanks for the reply. I don't have a separate index for each model. I have a separate index for each account, in which the mappings for each model (user and comments) are specified. In this case if any change has been done for user model or comment model, the index that has been created for the related account has to be updated. Is this possible? Please let me know if yes. I guess this is the way I specify the mappings in my case. Correct me if I'm wrong. Account Model:
The index is getting created correctly with both the mappings for account index. But, I don't see a way where I can update the index when any model specified in the mappings are changed. Whenever a new user is added or if an user is updated the index created for the corresponding account has to be updated. |
Hello, sorry for the delay.
This is a tricky thing to do, the only real solution I have found in several projects is to just "switch" the index/database name based on some criteria in your application (logged-in user, etc). Please see the #92 issue for a lot of Tire historical trivia, there is a solution outline at the end as well.
Yes, this is something you need to handle in your application. |
Hello, had a look at the solution? |
Oops sorry...Will look into it. Thanks for the reply. |
@ovamsikrishna Hello, any news? Closing? |
In my multi-tenant app (account based with number of users per account), how would I update index for a particular account when a user document is changed.
Rails 2.3 app applied changes as per loe@53d8510
Account Model
As you can see above, there are two models here user and comments. Is it the correct way to address single index with multiple models.
In that case how do I update index when a user document or comment document alone is changed.
The text was updated successfully, but these errors were encountered: