/**
 * Internal counter for added top hits aggregations.
 * @type {Number}
 */
let count = 0;

/**
 * Construct a Top hits aggregation.
 *
 * @param  {Object} opts  Options to include in the aggregation (maybe empty).
 * @param  {String} name  Aggregation name. Defaults to agg_top_hits_{count}.
 * @return {Object}       Top hits Aggregation.
 */
export default function topHitsAggregation(opts, name) {
  name = name || `agg_top_hits_${count++}`
  return {
    [name]: {
      top_hits: opts || {}
    }
  }
}

@@ -199,22 +199,24 @@
 tion
- (maybe empty)
+. Defaults to %7B%7D
 .%0A *
@@ -269,16 +269,17 @@
 ults to 
+'
 agg_top_
@@ -290,16 +290,17 @@
 _%7Bcount%7D
+'
 .%0A * @re
@@ -392,16 +392,21 @@
 ion(opts
+ = %7B%7D
 , name) 
@@ -499,14 +499,8 @@
 opts
- %7C%7C %7B%7D
 %0A   

Make use of ES6 default param values on topHitsAggregation