I am using Elastic Search in my Rails project. I am doing real time full text search using elasticsearch-model gem. Suppose Model A belongs to Model B. If I am doing a search on Model A I am getting 10 records of A based on my search parameters.
A.search(x) => Gives 10 records which includes all attributes of A.
But when I am accessing Model B through A like: A.B.some_attrib I am getting
undefined method B for <Elasticsearch::Model::Response::Result>
How to load the associations in ElasticSearch?
Also I want all the records in the search result. How to specify match_all in search method?
You can configure model associations with as_indexed_json method. Here is the psuedo code for that: