I have 3 different type 'user','school','user_preferences' in one index 'elastic' .Its structure would be as follows:
User Type:
|id|name|
|1 |User A|
|2 |User B|
School Type:
|id|school_name|
|1 |School A |
|2 |School AB |
|3 |School AB |
User preferences:
|user_id|type|prefered_id|
|1 |user |2 |
|2 |school |3 |
if my user id is '1' and am searching for a school 'AB' ,then i need to get the school which my friend is preferred and then other matched schools.here user_id '2' is my friend(see user_preference type) and he preferred school 'AB'(school id 3).So in search result i need to get that school in first result and then remaining matched items.How can i achieve this using Elasticsearch?Is it possible using Elasticsearch?