can this sort be implemented while pulling from elasticsearch? also, if not, i believe p is already an activerecord and we don't need to do the extra db call <code>Post.find_by_id(p.id.to_i)</code> should just be able to call <code>p.votes</code> though not positive