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 working
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


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

structure like


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
For more options, visit