Adding sorting to search results.

I think this should be in the charmstore package, as the values here are internal details of the stored ES document - knowledge of the ES document details should be kept private to charmstore IMO, so that when it changes we don't need to look for this code too.