Example of how to use elasticsearch as a database system
This project contains the scripts referenced in the blog post:
http://stefansavev.com/blog/elasticsearch-as-a-database-system/
In particular interest could be computation of hot (trending) items as measured by the number of DISTINCT users who clicked on an item within some time interval: