A proper answer would need a bit more code to understand your situation correctly.
But, generally, as an example:
- You'd store the user ID(s) for users who can access/manipulate a document directly in the document (eg.
author_ids
property)
- You'd pass the user ID (based on the
current_user.id
value) to a term
/terms
filter.
- Alternatively, you can use a boolean query, but filters would be faster and more effiecient.
- Your results are filtered.
Note, that there are many more possible approaches with elasticsearch and Tire, for instance:
- You use the “filtered aliases” feature in elasticsearch, to set up a “virtual” index for each user, automatically filtered on the elasticsearch layer.
- You inject this index name to searches in Tire.