func (a *SerialDiffAggregation) Source() (interface{}, error) {
	source := make(map[string]interface{})
	params := make(map[string]interface{})
	source["serial_diff"] = params
	if a.format != "" {
		params["format"] = a.format
	}
	if a.gapPolicy != "" {
		params["gap_policy"] = a.gapPolicy
	}
	if a.lag != nil {
		params["lag"] = *a.lag
	}
	switch len(a.bucketsPaths) {
	case 0:
	case 1:
		params["buckets_path"] = a.bucketsPaths[0]
	default:
		params["buckets_path"] = a.bucketsPaths
	}
	if len(a.meta) > 0 {
		source["meta"] = a.meta
	}
	return source, nil
}
Source returns the a JSON-serializable interface.
package elastic
type SerialDiffAggregation struct {
	format    string
	gapPolicy string
	lag       *int
	meta         map[string]interface{}
	bucketsPaths []string
}
func NewSerialDiffAggregation() *SerialDiffAggregation {
	return &SerialDiffAggregation{
		bucketsPaths: make([]string, 0),
	}
}
func (a *SerialDiffAggregation) Format(format string) *SerialDiffAggregation {
	a.format = format
	return a
}
func (a *SerialDiffAggregation) GapPolicy(gapPolicy string) *SerialDiffAggregation {
	a.gapPolicy = gapPolicy
	return a
}
func (a *SerialDiffAggregation) GapInsertZeros() *SerialDiffAggregation {
	a.gapPolicy = "insert_zeros"
	return a
}
func (a *SerialDiffAggregation) GapSkip() *SerialDiffAggregation {
	a.gapPolicy = "skip"
	return a
}
func (a *SerialDiffAggregation) Lag(lag int) *SerialDiffAggregation {
	a.lag = &lag
	return a
}
func (a *SerialDiffAggregation) Meta(metaData map[string]interface{}) *SerialDiffAggregation {
	a.meta = metaData
	return a
}
func (a *SerialDiffAggregation) BucketsPath(bucketsPaths ...string) *SerialDiffAggregation {
	a.bucketsPaths = append(a.bucketsPaths, bucketsPaths...)
	return a
}