I actually wanted to do a hourly index - per user action (unless it's an overkill) - i'd just delete the hourly index after an hour, so my flow will be:
- User does an action
- Query the documents in the main index that relate to this action
- Move them to a hourly per action index, and delete from main index
- if user regrets, move them back and delete the action index
- after 1H, the entire per-action index should be deleted.
Besides that i have another complexity, is that 2 seperate actions can affect the same document, so if one user regrets, the document should not be returned, as the 2nd action deleted it.
i can manage it by retaining connections between those actions
It gets complex, but the other option is to retain 1 recylce_bin index, and save the connections on the actions on the documents themselves (meaning - i'll have to do uppdates on those document, and they will contain the "action" field, for example, the recycle bin can be something that:
"doc name" :"1"
"doc name" :"2"
which will cause every user UNDO to find the documents containing those undo actions, and perform the following:
- remove the action from the "Actions" array, if it's the only one - bring back the document to life
- If there are other actions there, keep them in the recycle bin
after 1H i'll also need to have a process that deletes those documents (and updates the ones that have more actions).
it gets complex, but maybe the efficiency there is not terrible as the undo doesn't happen alot