hello everyone
I want to implement an advanced search system that has the ability to sort results by their popularity. I feel that update operation is expensive in elastic search. what is the best way to store user likes on my elastic documents.
do I have to increment the likes count each time a user likes a post? or do I have to get results from elastic and sort them based on data in MYSQL database of my app?
by the way my app is implementing the microservice architecture. if you have any idea or blog post about implementing a centralized search service I'll be happy to hear that
Here's the trick a company did in the past for the likes.
As it is costly indeed, they were updating each like between let say 0 and 100 likes.
After 100, they were updating every 10 likes.
After 1000, every 50 likes.
After 10000, every 500 or so...
You have the idea.
That way, very popular content was not heavily updated but they were able to give an idea of the number of likes...
It was in 2014 IIRC. There are may be other ways to solve that now.
Hi @alireza_jazayerei
To add on to what @dadoonet recommended you can also pull the likes out into a separate index / doc so that that you are not updating the core document... then when you pull back that doc you pull the likes that match (you can use the doc _id from the content doc to match etc) ... you can still even use the the method above as to how you update.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.