I want to make ES aggregation on many to many activerecord model on rails but no way My model :
class Foo < ApplicationRecord
searchkick
def search_data
{
bar: bar
}
end
has_many :bars
end
I have tried many solution but always get
{"active"=>{"doc_count_error_upper_bound"=>0, "sum_other_doc_count"=>0, "buckets"=>[]}}
The answer is add this :
def search_data
Attributes.merge(
bar_names: bar.map(&:name)
)
end