# Likes and favourite item search and storage

**URL:** https://discuss.elastic.co/t/likes-and-favourite-item-search-and-storage/19795
**Category:** Elasticsearch
**Created:** [September 15, 2014, 4:51pm UTC](https://discuss.elastic.co/t/likes-and-favourite-item-search-and-storage/19795 "2014-09-15T16:51:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Michael\_5](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@Michael\_5](https://discuss.elastic.co/u/Michael_5)
#### Post date: [September 15, 2014, 4:51pm UTC](https://discuss.elastic.co/t/likes-and-favourite-item-search-and-storage/19795/1 "2014-09-15T16:51:15Z")

</div>

Hi,

I'm looking for the best practise for recording 'likes' of an item.

If I have a document

{  
'name' : 'Dave',  
'age' : 40,  
'album' : 'foo'  
}

If people decide to 'like' 'Daves' album 'foo'. Where is the best place to  
store these 'likes'? in the document?

{  
'name' : 'Dave',  
'age' : 40,  
'album' : 'foo',  
'likes' : {  
'user1',  
'user2',  
}  
}

Or store the likes in a different type? Because When I return results for  
albums, Dave's album should rank higher because that album has more likes.  
But also I want to show how many likes the album has. But with people  
liking and un-liking albums, I want to avoid conflicts with updates.

So what is the best approach? Should I put everything into a queue? How  
will I query and arrange by number of likes if the documents are separated?

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a5238715-5df0-40a9-b06f-f33f8d22cc92%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a5238715-5df0-40a9-b06f-f33f8d22cc92%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:02am UTC](https://discuss.elastic.co/t/likes-and-favourite-item-search-and-storage/19795/2 "2017-07-06T01:02:13Z")

</div>


