# Show only results that are relevent to my shopping history

**URL:** <https://discuss.elastic.co/t/show-only-results-that-are-relevent-to-my-shopping-history/333149>\
**Category:** Elasticsearch\
**Created:** [May 11, 2023, 4:58am UTC](https://discuss.elastic.co/t/show-only-results-that-are-relevent-to-my-shopping-history/333149 "2023-05-11T04:58:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![searchwithme](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/searchwithme/32/137075_2.png) [@searchwithme](https://discuss.elastic.co/u/searchwithme)\
**Post date:** [May 11, 2023, 4:58am UTC](https://discuss.elastic.co/t/show-only-results-that-are-relevent-to-my-shopping-history/333149/1 "2023-05-11T04:58:12Z")

</div>

I want to understand if elasticsearch + knn could be used to accomplish this ask: a search on an item should only show relevent results with my shopping history.

eg) search on dress should only show red or black or full sleeve (as my shopping history could be filled with items in this category)

---

<div class="post-metadata">

**Author:** ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)\
**Post date:** [June 6, 2023, 11:05pm UTC](https://discuss.elastic.co/t/show-only-results-that-are-relevent-to-my-shopping-history/333149/2 "2023-06-06T23:05:38Z")

</div>

Hello @searchwithme,

If I understood correctly, you would like to perform a KNN search but limit the search to documents that have a specific value for the "category" field. In this example, the "category" field represents the shopping history category. You want to retrieve the top k documents that match this specific category value. If that's the case, you can achieve this by performing a [filtered KNN search](https://www.elastic.co/guide/en/elasticsearch/reference/current/knn-search.html#knn-search-filter-example).

---

<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 4, 2023, 11:05pm UTC](https://discuss.elastic.co/t/show-only-results-that-are-relevent-to-my-shopping-history/333149/3 "2023-07-04T23:05:44Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
