Performance concerns for the "like" status of rows / objects

Has anyone an idea how to check the like status of an object efficient for the current logged in user? The data comes from an elastic index and I could in theory store all the likes along the object and check if the users like is in that array. We won’t get millions of likes so this should not be a performance issue but I don’t like the solution.

Another solution would be to do a 2nd query against ES or mysql and fetch all likes for the ids and the current user and assign the like status for the paginated results manually. Any better ideas?

The issue is not the technical implementation itself but performance concerns.

A solution would be a graph based DB like Neo4j or OrientDB but we won’t add yet another DB to the project. Our index is kept up to date when the SQL Db changes. Actually the first approach would be better because the 2nd approach would require a lot code to assign the right value to each object. We also have a global search that returns multiple types.

My issue with the first approach is that I don’t want to store even just 1000 likes in ES together with the object. Seems like a waste of space and might cause performance issues.

I would personally do a second query to mysql / elastic search or redis. For listing views I ould collect all the ids of the items that are “likeable” and then use a single query to get the status of all of them at once. You can reuse the same logic for a single item view.