Top hits aggregation group by

Hi,

I am using top_hits_aggregation to get my users last visited document. I want to group by the results of top_hits_aggregation.

Sample Rows Returned

`{
    "lastvisited_users": {
       "buckets": [
          { 
              "top_user_hits": {
                    "hits": {
                         "hits": [
                            { _source: {"c": "s"}},
                            { _source: {"c": "s,b"}}, 
                            { _source: {"c": "s"}}, 
                          ] 
                   }
              }
          }
       ]
    }
}`

I want to group by the results by field "c".

Expected

{
  "s": 2,
  "s,b": 1
}

I am using elasticsearch version 1.7 in production. How to do this?