Added support for sorting buckets based on single-bucket sub aggregations (based on their doc_count)

 Closes #5253