Popularity Sort and Rethinkdb

Goal: sort items by popularity using a unit of time (1 hour, 24 hours, week, etc.)

I'm using rethinkdb for storing the likes. To grab the likes of all the users in the past 24 hours, I do something like this:

r.table('users')('likes').between(/*24 hours*/).run()

I then count the times an item appears and put the id of the item in a dictionary along with its like count
I then have to query for the liked items to get all of their information needed for display to a user.

If I do all of this every 5 minutes, I should have the desired results.

Is there a better way to do this with elasticsearch?
Is it easy for me to use elasticsearch with rethinkdb or to move my existing data over to elasticsearch and begin storing it there?

You probably want a date range agg with another on the users field (terms sub-agg).
Honestly though, it won't be as easy as that single line.

We can't answer that, only you can.