Hello guys,
first let me apologize for my english, I'm from Argentina. I've to say i
don't have lots of experience with ES, so forgive me if say something wrong.
Here's my problem.
I'm building something similar to a social networking site. I've got users
and friendships between users. Something really similar to facebook. At the
top of the page, each user see a search bar where he/her can search for
people there (again, similar to FB).
I've followed this great tutorial by Clinton:
http://elasticsearch-users.115913.n3.nabble.com/help-needed-with-the-query-tt3177477.html#a3178856 And
i've got something working right now. Actually I've got a pretty good
results with that looking for users.
The problem is that when a user search in that search bar I'd like to
search first for his/her friends, and after that i'd like to get regular
users. I mean, if the user types "Rob" i'd like to get something like:
Rob Smith (Friend)
Robert Bonham (a friend too)
Rob Jones (Not a friend)
Roberta Mendez (Not a friend).
Plain simple: It should be sorted by friendship (first appear the friends
of the user).
What i got now is a type with a mapping for the "user" type, where i have
all my users. The problem is how to structure my types and mapping in order
to sort by this "friendship" condition.
The only thing i can think now is having a mapping for each user containing
it's friends, something like:
(supposing the user seraching ID is 1000)
http://host:9200/mySocialNetwork/friend/1000/_search?name=Rob
I could search for that first and after that intersect that result with
this:
http://host:9200/mySocialNetwork/user/_search?name=Rob
But, that doesn't seem really well, I think must be some better way to do
this.
Can you help me?
Thank you a lot!