0
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.

tomekfranek
  • 6,852
  • 8
  • 45
  • 80

1 Answers1

0

Here is a pretty good answer for authorizing elasticsearch results:

Authorize elasticsearch results with cancan

Community
  • 1
  • 1
spas
  • 1,914
  • 14
  • 21