You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer, I would like to see an example of an index which is derived from multiple Ruby models. Based on the documentation today, I only see indices with a single index_scope defined. I am actually not sure if it is possible today, but I would like to update my Elasticsearch documents multiple-model associations:
classEmployee < ActiveRecord::Base# TODO: How to update specific `restaurant` document(s)?# update_index('restaurant') { ??? }endclassCuisine < ActiveRecord::Base# TODO: How to update specific `restaurant` document(s)?# update_index('restaurant') { ??? } endclassRestaurant < ActiveRecord::Basehas_many:employeeshas_many:cuisinesupdate_index('restaurant'){self}endclassRestaurantsIndex < Chewy::Indexindex_scopeRestaurantend
In this contrived example, a Restaurant would have a foreign key relationship with Employee and Cuisine, but an Employee nor a Cuisine do not necessarily belong to a Restaurant. Therefore, when the associated records update, the RestaurantsIndex would miss these updates, correct? How can we ensure our index is always up-to-date with our DB record associations?
I did come across #34 before making this issue. However, this seems to reference an older syntax / version of Chewy.
The text was updated successfully, but these errors were encountered:
As a developer, I would like to see an example of an index which is derived from multiple Ruby models. Based on the documentation today, I only see indices with a single
index_scope
defined. I am actually not sure if it is possible today, but I would like to update my Elasticsearch documents multiple-model associations:In this contrived example, a
Restaurant
would have a foreign key relationship withEmployee
andCuisine
, but anEmployee
nor aCuisine
do not necessarily belong to aRestaurant
. Therefore, when the associated records update, theRestaurantsIndex
would miss these updates, correct? How can we ensure our index is always up-to-date with our DB record associations?I did come across #34 before making this issue. However, this seems to reference an older syntax / version of Chewy.
The text was updated successfully, but these errors were encountered: