I'm working on creating a search feature for a social network like Mobile App.
Users can follow each other and search by username, lastname or firstname. Currently we are just indexing username, lastname and firstname into Elasticsearch and store the full user information in a seperate primary Database, referenced by an id stored in Elasticsearch and the primary DB.
Our friend relations are stored in the following schema in Google Bigtable:
requesterID is the id of the person who requested to follow the other person. The
requestedID is the id of the person who can accept the request.
So we have a bunch of rows referencing the relations between two users but we currently can't include friend relations in our user search. We would like to boost the rank of search results if the person who is searching is following the other person in the search result.
So it would list people who your following first in a search result.
Is there a way to model relations in Elasticsearch so that they can be included in a search query?
My first guess would be to store the id's of friends in an array, like: [102,106,120]. But I don't think that this is scalable if a user has thousand of friends.