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
How do I then use ActiveRecord select() to only pull certain fields on the model records returned? An Elasticsearch response records enumerator doesn't respond to the select() method that a normal ActiveRecord::Relation would.
I see that I can do Model.search("search").records.records.select('some_field') to select the fields correctly because the 2nd .records is an ActiveRecord::Relation but....
Model.search("search").records.records <-- not sorted correctly!
Is there some other way of approaching this that I am missing or is it just not appropriate to select less than the full list of fields when returning sorted records via an ES search?
The text was updated successfully, but these errors were encountered:
TheCorp
changed the title
How to select individual fields on records?
How to select individual fields on records while keeping them sorted by _score?
Aug 20, 2019
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have a simple model and a search query that is returning results sorted correctly.
Model.search("search").records
<- sorted correctlyHow do I then use ActiveRecord
select()
to only pull certain fields on the model records returned? An Elasticsearch response records enumerator doesn't respond to theselect()
method that a normal ActiveRecord::Relation would.I see that I can do
Model.search("search").records.records.select('some_field')
to select the fields correctly because the 2nd.records
is an ActiveRecord::Relation but....Model.search("search").records.records
<-- not sorted correctly!Is there some other way of approaching this that I am missing or is it just not appropriate to select less than the full list of fields when returning sorted records via an ES search?
The text was updated successfully, but these errors were encountered: