I am pretty new to Rails and ES. I have a query that was working and now I want to limited the results to only the current_user but I am having trouble with what to include in my controller.
It doesn't like the where method - thanks for any help
@galleries = Gallery.search params[:q], where: {user_id: current_user.id}
def self.search(query, user_id)
__elasticsearch__.search(
{
query: {
bool: {
must: [{
multi_match: {
query: query,
fields: ['name', 'memory', 'memory_date']
}
}],
filter: [{
term: {"user_id" => user_id}
}]
}
}
}
)
end