I have a question about how a specific use case should be modelled in ElasticSearch.
I have an application where users can search for recommendations with several parameters and like/dislike each returned recommendation item. As it is now, recommendations that the user previously has disliked might show up again. So the question is; How can I keep track of each users disliked recommendations and exclude them from the result in an efficient way?
So if user1 search for recommendations and the result is: rec1, rec2, rec3, rec4, rec5
If user1 then dislikes rec1 and rec2, and does the same search again, the result should be: rec3, rec4, rec5
I’m aware that the search params should then contain the searching user’s id, and that some kind of user disliked recommendation list should be maintained in elastic search, but is that efficient enough if the application gains a large user base with many recommendation dislikes?
You can certainly index "user" documents and keep a list of dislikes in an array. However, having ES automatically "join" to that user's document and modify its search parameters based on a field in that document is not possible.
You're best bet is to load the user's preferences into a session in the application that sits between the user and ES. From there, you'll have to modify any queries that go to ES to exclude items that the user has disliked.