Tire.search index do
query do
filtered do
query { string term }
filter :or, { missing: { field: :group_id } },
{ terms: { group_id: group_ids } }
filter :not { type: "Movie" } if current_user.has_not_permission("Movie")
end
end
end.results
I would like to exclude all Movie results if user has not permission to movie.
Here is a pretty good answer for authorizing elasticsearch results:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.