# How a user can favorite a item in a search ( many to many ) - product - user

**URL:** https://discuss.elastic.co/t/how-a-user-can-favorite-a-item-in-a-search-many-to-many-product-user/347424
**Category:** Elasticsearch
**Created:** [November 17, 2023, 4:33pm UTC](https://discuss.elastic.co/t/how-a-user-can-favorite-a-item-in-a-search-many-to-many-product-user/347424 "2023-11-17T16:33:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Murilo\_Livorato](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/murilo_livorato/32/123848_2.png) [@Murilo\_Livorato](https://discuss.elastic.co/u/Murilo_Livorato)
#### Post date: [November 17, 2023, 4:33pm UTC](https://discuss.elastic.co/t/how-a-user-can-favorite-a-item-in-a-search-many-to-many-product-user/347424/1 "2023-11-17T16:33:15Z")

</div>

![favoriteitem](https://us1.discourse-cdn.com/elastic/original/3X/9/1/91b81e439d38701ef7699a9f4897cb835a1b082b.jpeg)

hello , I wonder to know how a user could to save favorites , like this image .  
if I use a relational database , I could make a many to many relational .

but with Elasticsearch . how could I do it ?

I know that I could join the product with the user , like this -

> **[Joining queries | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/joining-queries.html)**

but , the problem is that Elasticsearch works with shards , and if start saving a lot of products , I dont know if it wold nbe the best idea to keep the USER\_SAVES\_PRODUCT in Elasticsearch or in other database .

what wold be the best way Elasticsearch interact with user saves products ?  
wold keep the user save produtcs in other database ? or keep all in Elasticsearch ?

---

<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: [December 15, 2023, 4:33pm UTC](https://discuss.elastic.co/t/how-a-user-can-favorite-a-item-in-a-search-many-to-many-product-user/347424/2 "2023-12-15T16:33:33Z")

</div>

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