With Composite Aggregations you can only sort by the grouped by fields (you can only change to descending order if you wish).
But just to clarify, why do you want to ORDER BY a field that it's not in the group by or the select list?
This query is not a valid SQL query, PostgreSQL for example will return:
column "field_7" must appear in the GROUP BY clause or be used in an aggregate function
Composite aggs through ES API don't allow to group by anything else than the group by fields
ES SQL API though allows you to also order on aggregate function:
e.g.:
SELECT field_1, count(*) as cnt
FROM test
GROUP BY field_1
ORDER BY cnt
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.