# How can I keep track of each users disliked items and exclude them from the result in an efficient way

**URL:** <https://discuss.elastic.co/t/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-result-in-an-efficient-way/24479>\
**Category:** Elasticsearch\
**Created:** [June 27, 2015, 10:49am UTC](https://discuss.elastic.co/t/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-result-in-an-efficient-way/24479 "2015-06-27T10:49:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeppe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeppe/32/3493_2.png) [@Jeppe](https://discuss.elastic.co/u/Jeppe)\
**Post date:** [June 27, 2015, 10:49am UTC](https://discuss.elastic.co/t/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-result-in-an-efficient-way/24479/1 "2015-06-27T10:49:20Z")

</div>

Hi

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?

I've also created the question on stackoverflow: [http://stackoverflow.com/questions/31087806/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-resu](http://stackoverflow.com/questions/31087806/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-resu)

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [June 29, 2015, 1:45pm UTC](https://discuss.elastic.co/t/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-result-in-an-efficient-way/24479/2 "2015-06-29T13:45:20Z")

</div>

with a not filter? [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-not-filter.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-not-filter.html)

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 29, 2015, 2:34pm UTC](https://discuss.elastic.co/t/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-result-in-an-efficient-way/24479/3 "2015-06-29T14:34:02Z")

</div>

Large lists of exclude terms can be stored - see [https://www.elastic.co/blog/terms-filter-lookup](https://www.elastic.co/blog/terms-filter-lookup)

---

<div class="post-metadata">

**Author:** ![Jeppe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeppe/32/3493_2.png) [@Jeppe](https://discuss.elastic.co/u/Jeppe)\
**Post date:** [June 29, 2015, 6:15pm UTC](https://discuss.elastic.co/t/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-result-in-an-efficient-way/24479/4 "2015-06-29T18:15:24Z")

</div>

Thank you for answering.

Would this terms filter lookup work for let's say thousands of terms and not just up to 1000. What if I had 10.000-50.000 terms and they were added continuously?

Would a parent/child relationsship be better then and which solution would have the best performance?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:04am UTC](https://discuss.elastic.co/t/how-can-i-keep-track-of-each-users-disliked-items-and-exclude-them-from-the-result-in-an-efficient-way/24479/5 "2017-07-06T00:04:44Z")

</div>


