elasticsearch - Complex tire query involving nested models -


i have following models.

class author     include tire::model::search     include tire::model::callbacks      has_many :books     has_many :tags #(eg: 'german', 'philosopher') end  class book     belongs_to :author     belongs_to :book_type #(eg: 'paperback', 'hardcover')     has_many :tags #(eg: 'crime', 'drama') end 

i need in understanding , writing following search queries,

 find authors tagged 'german' , 'philosopher'                      have written @ least 1 book each of book_type 'paperback' , 'hardcover'                      each such book tagged 'crime' , 'drama'  find authors tagged 'german' , 'philosopher'                      have written @ least 1 book of book_type                      book tagged 'crime' , 'drama' 

i added mini rails project sample seed data @ https://github.com/rahul/nested_tire_query_problem

update

i tried write mapping author in include books type 'nested'. to_indexed_json method overrides definition in mapping , creates non-nested books inside author.

backend: mysql (i use to_indexed_json feed documents elasticsearch)

any appreciated!

solved. here link answer: https://github.com/karmi/tire/issues/794


Comments