Wildbook
Wildbook copied to clipboard
OpenSearch indexing permissions logic does not scale
Context
For our OpenSearch encounter search, results need to respect permission of user; they only get results they have access to. Related, indexing of data computes the values necessary to filter based on permission. Indexing currently does this - but it is broken, or at best inefficient in a few ways. This is especially apparent in a fully loaded Wildbook with 1000+ users. This single-property bottleneck should be avoided.
Requirements
This is the current proposed solution, but adjustments may happen. Changes will be documented in ticket
- Indexing of objects continues to work as it currently does, except for the computation of permissions field(s).
- Permission computation is saved for a separate process, which will use a
PATCHon the indexed documents to update just the permission field(s) - This permission process will only happen when needed, and will happen in a "batched" way. For example, every 5 minutes permissions indexing checks to see if changes to permissions have been made. If not, it can be skipped.
- This will hopefully greatly increase efficiency, as it allows the looping through all users to happen only once, across all data, rather than requiring the user-loop to be iterated through for every single change
- Change-triggered (single object) indexing may or may not still trigger permissions computation on that single object - TBD