title: ElasticSearch Order after 2 term aggregation
body: <p>Suppose that I have the following documents in ES, each has 3 fields: f1, f2 and score.
  I want to find all documents, group by f1, f2 and order by the group max score, in SQL I can simply do like this:</p>
  
  <p><code>select f1,f2,score from table group by f1,f2 order by max(score)</code></p>
  
  <p>What is the equivalent in elasticsearch? Nested term aggregation doesn't give correct order as the returned buckets of f2 terms are all nested in the same bucket of f1 terms.</p>