Official documentation : https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-nested-aggregation.html

Stackoverflow question : https://stackoverflow.com/questions/47254564/how-to-do-two-nested-aggregations-in-elasticsearch

 

//TODO in progress