code: func (a *BucketSortAggregation) Source() (interface{}, error) {
  	source := make(map[string]interface{})
  	params := make(map[string]interface{})
  	source["bucket_sort"] = params
  
  	if a.from != 0 {
  		params["from"] = a.from
  	}
  	if a.size != -1 {
  		params["size"] = a.size
  	}
  
  	if a.gapPolicy != "" {
  		params["gap_policy"] = a.gapPolicy
  	}
  
  	// Parses sorters to JSON-serializable interface.
  	if len(a.sorters) > 0 {
  		sorters := make([]interface{}, len(a.sorters))
  		params["sort"] = sorters
  		for idx, sorter := range a.sorters {
  			src, err := sorter.Source()
  			if err != nil {
  				return nil, err
  			}
  			sorters[idx] = src
  		}
  	}
  
  	// Add metadata if available.
  	if len(a.meta) > 0 {
  		source["meta"] = a.meta
  	}
  
  	return source, nil
  }
docs: // Source returns the a JSON-serializable interface.