-
Notifications
You must be signed in to change notification settings - Fork 802
each_with_hit doesn't support includes to eager load associations #221
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
Comments
@sr3d Yeah, I don't think this is possible, since the |
So, any news? I don't see this as immediately supportable/implementable. I'd lean to close this ticket. |
Just thought I'd give an update to this. I also ran into this, and quite frankly, eager loading (using I also contemplated modifying the elasticsearch-model gem, but ended up making a class called EagerPagination that solves this. The gist can be found here, and a blog post can be found here: https://gist.github.com/dimroc/ccc6c80c747ee8f957f3 http://www.dimroc.com/2014/11/12/eager-pagination-with-elasticsearch-rails/ Let me know what you think. |
for reference, includes support was added: #472 |
Hello, I might be missing something here but the following still fails (on
Is there any workaround for this scenario? I need to include the Elasticsearch Right now I'm forced to remove the Thanks in advance! |
collection.records.includes(:some_association).each_with_hit will error out: undefined method `each_with_hit' for #School::ActiveRecord_Relation:0x007fb13c51fe88
I looked around the source code and couldn't see it at all
(https://sourcegraph.com/github.com/elasticsearch/elasticsearch-rails@b500bf03d18f0852b9ee6ebc1aa15fe684f9a9f2/.tree/elasticsearch-model/lib/elasticsearch/model/response/records.rb). With Tire gem it's possible but somehow in the ES-Rails it's not.
The text was updated successfully, but these errors were encountered: