Elasticsearch, terms aggs according to sibling nested fields

FINALLY! FOUND AN ANSWER!!!

"aggs": {
    "INFS": {
      "terms": {
        "field": "smp_id.keyword",
        "order": {
          "LATEST > SUM_SVALUE": "desc"
        }
      },
      "aggs": {
        "LATEST": {
          "nested": {
            "path": "latest"
          },
          "aggs": {
            "SUM_SVALUE": {
              "sum" : {
                "field": "latest.soc_mm_score"
              }
            }
          }
        }
      }
    }
}

Displays the following sample:

FINAL