I have a python app which connects to an Elasticsearch database, and creates a document, let's say a book. This book has several links to other documents, let's call tell them pages.
In our python app, the user can CRUD a book. When he creates a book from scratch, the app automatically creates the pages belonging to that book.
The problem is that users may delete books, when others users request reading a page of that book. Or the users may update that same book, and join more pages to that book in the process.
How should we avoid race conditions, and interference between different users?