I have looked at the different aggregations available with Elastic Search.
But I assume this is currently not possible, as this requires aggregation at multi level ( for hierarchal data) and passing the result of one aggregation to another aggregation.
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.