Real estate property likes and views

Am working on a property finder project. We are using Elasticsearch to enable flexibility for user to search property. We have option in our app to show whether a user viewed a property before or no while its listed and similarly user can also like a property. What is the best way to store user views and likes data in Elasticsearch. Currently am using Postgres to join the search result with user likes and user views. Now am looking to get rid of this join and accomplish this inside Elasticsearch itself.
Is it good practice to store the user likes and user views inside a document as an array? Say i will be having likedusers and viewedusers array of user ids. These 2 fields will be updating regularly based on the user activity.

Internally Elasticsearch does not support partial update of documents.
Even if using Update API, it is almost the same with delete the existing document and create a new document.

It may cause serious performance problem to store the user likes and user views inside a document . You may need performance test to check if it is acceptable. If the number of viewers and likers per one property is up to tens or thousands, however, it could be acceptable.

Storing view logs and like logs in other indices could be another option.

Am planning to store listing views and likes in a separate indices. Is there any way to retrieve for each document a boolean field based on the user liked or no from another index in one query.

I suppose you need separete queries for different indices. What is your query? Are there any requirements?

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