code: func (a *aggContainer) MarshalJSON() ([]byte, error) {
  	root := map[string]interface{}{
  		a.Type: a.Aggregation,
  	}
  
  	if len(a.Aggs) > 0 {
  		root["aggs"] = a.Aggs
  	}
  
  	return json.Marshal(root)
  }
docs: // MarshalJSON returns the JSON encoding of the aggregation container