How we can create leaderboards(ranking) using elasticsearch

I want to make leaderboard for my website (weekly,monthly,yearly,alltime)
similar to how stackoverflow leagues are workinghttp://stackexchange.com/leagues/1/week/stackoverflow.
Whats the best way to create users ranking also consider ties? I also want
to show the current user ranking. I am using java for my app.

I have a two types in an elasticsearch index

  1. First type *user *where users cumulative points/score is saved structure
    like

user_id,
total_points

  1. Second type *post_points *where user points for each post is saved

structure like

user_id
post_id
points
date

Users ranking can be calculated using a following elasticsearch range (not
tested) but how user own ranking also consider ties can be calculated?

{
"range" : {
"date" : {
"gt" : 'week/month/year date'
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.