Well "term facets" is very good choice and it almost solved my problem, but
The problem is I have is 2 Indexes
1st index is for saving the main docs and 2nd index for saving the relations
now problem is
Suppose I have 100 USER Docs in my main index, only 50 of them has made
relations, so I'll have only 50 USER Docs in my relationship index
So when i implement the "term facet", it sorts the results and gives the
correct output i want, but I am missing those left 50 users who don't have
any relations yet, i need them in my final output after the 50 sorted users.
On Saturday, August 11, 2012 6:28:55 PM UTC+5:30, David Pilato wrote:
What about TermFacet on field user_id_2?
--
Le 11 août 2012 à 14:39, Chetan Sharma <ca...@izap.in <javascript:>> a
écrit :
I am saving user relations in ES Index
i.e
{'id' => 1, 'User_id_1' => '2001', 'relation' => 'friend', 'User_id_2' =>
'1002'}
{'id' => 2, 'User_id_1' => '2002', 'relation' => 'friend', 'User_id_2' =>
'1002'}
{'id' => 3, 'User_id_1' => '2002', 'relation' => 'friend', 'User_id_2' =>
'1001'}
{'id' => 4, 'User_id_1' => '2003', 'relation' => 'friend', 'User_id_2' =>
'1003'}
no suppose i want to get the user_id_2 who has most friends,
in above case its 1002 as 2001, and 2002 are its friends. (Count = 2)
I just can't figure out the query
Thanks.
--
--