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
I'm using ActiveModelSerializers to render json. In some cases, I'm calling #to_a on instances of Searckick::Results and rendering that. But my serializers have associations that are not indexed in elasticsearch. This is ending up in a n+1 query to the database and makes queries extremely slow.
Is there a way to eager load these associations at render time?
To be honest, I'm not sure if a good solution lies in Elasticsearch, ActiveRecord, Rails, AMS, or searchkick land. I don't think this is a searchkick issue, but opening it here because @ankane has been really helpful in the past and this seems like something other searchkick users could benefit from knowing. Stackoverflow is fairly unresponsive for niche issues like this.
The text was updated successfully, but these errors were encountered:
I'm using ActiveModelSerializers to render json. In some cases, I'm calling
#to_a
on instances ofSearckick::Result
s and rendering that. But my serializers have associations that are not indexed in elasticsearch. This is ending up in a n+1 query to the database and makes queries extremely slow.Is there a way to eager load these associations at render time?
To be honest, I'm not sure if a good solution lies in Elasticsearch, ActiveRecord, Rails, AMS, or searchkick land. I don't think this is a searchkick issue, but opening it here because @ankane has been really helpful in the past and this seems like something other searchkick users could benefit from knowing. Stackoverflow is fairly unresponsive for niche issues like this.
The text was updated successfully, but these errors were encountered: