elasticsearch-rails icon indicating copy to clipboard operation
elasticsearch-rails copied to clipboard

Feature request: allow eager loading when searching across multiple models

Open SeanLF opened this issue 3 years ago • 0 comments

When searching on a single model, we can chain methods like includes. However this fails when searching across multiple models:

search = Elasticsearch::Model.search(query: {}, [ModelA, ModelB])
db_records = search.records.includes(:association)

=> Elasticsearch::Transport::Transport::Errors::BadRequest

It'd be nice to be able to do this without having to monkey patch the library.

SeanLF avatar Apr 09 '21 09:04 SeanLF