func (s FieldSort) Source() (interface{}, error) {
	source := make(map[string]interface{})
	x := make(map[string]interface{})
	source[s.fieldName] = x
	if s.ascending {
		x["order"] = "asc"
	} else {
		x["order"] = "desc"
	}
	if s.missing != nil {
		x["missing"] = s.missing
	}
	if s.ignoreUnmapped != nil {
		x["ignore_unmapped"] = *s.ignoreUnmapped
	}
	if s.unmappedType != nil {
		x["unmapped_type"] = *s.unmappedType
	}
	if s.sortMode != nil {
		x["mode"] = *s.sortMode
	}
	if s.nestedFilter != nil {
		src, err := s.nestedFilter.Source()
		if err != nil {
			return nil, err
		}
		x["nested_filter"] = src
	}
	if s.nestedPath != nil {
		x["nested_path"] = *s.nestedPath
	}
	return source, nil
}
Source returns the JSON-serializable data.
package elastic
import "errors"
type Sorter interface {
	Source() (interface{}, error)
}
type SortInfo struct {
	Sorter
	Field          string
	Ascending      bool
	Missing        interface{}
	IgnoreUnmapped *bool
	SortMode       string
	NestedFilter   Query
	NestedPath     string
}
func (info SortInfo) Source() (interface{}, error) {
	prop := make(map[string]interface{})
	if info.Ascending {
		prop["order"] = "asc"
	} else {
		prop["order"] = "desc"
	}
	if info.Missing != nil {
		prop["missing"] = info.Missing
	}
	if info.IgnoreUnmapped != nil {
		prop["ignore_unmapped"] = *info.IgnoreUnmapped
	}
	if info.SortMode != "" {
		prop["mode"] = info.SortMode
	}
	if info.NestedFilter != nil {
		src, err := info.NestedFilter.Source()
		if err != nil {
			return nil, err
		}
		prop["nested_filter"] = src
	}
	if info.NestedPath != "" {
		prop["nested_path"] = info.NestedPath
	}
	source := make(map[string]interface{})
	source[info.Field] = prop
	return source, nil
}
type ScoreSort struct {
	Sorter
	ascending bool
}
func NewScoreSort() ScoreSort {
	return ScoreSort{ascending: false}  
}
func (s ScoreSort) Order(ascending bool) ScoreSort {
	s.ascending = ascending
	return s
}
func (s ScoreSort) Asc() ScoreSort {
	s.ascending = true
	return s
}
func (s ScoreSort) Desc() ScoreSort {
	s.ascending = false
	return s
}
func (s ScoreSort) Source() (interface{}, error) {
	source := make(map[string]interface{})
	x := make(map[string]interface{})
	source["_score"] = x
	if s.ascending {
		x["reverse"] = true
	}
	return source, nil
}
type FieldSort struct {
	Sorter
	fieldName      string
	ascending      bool
	missing        interface{}
	ignoreUnmapped *bool
	unmappedType   *string
	sortMode       *string
	nestedFilter   Query
	nestedPath     *string
}
func NewFieldSort(fieldName string) FieldSort {
	return FieldSort{
		fieldName: fieldName,
		ascending: true,
	}
}
func (s FieldSort) FieldName(fieldName string) FieldSort {
	s.fieldName = fieldName
	return s
}
func (s FieldSort) Order(ascending bool) FieldSort {
	s.ascending = ascending
	return s
}
func (s FieldSort) Asc() FieldSort {
	s.ascending = true
	return s
}
func (s FieldSort) Desc() FieldSort {
	s.ascending = false
	return s
}
func (s FieldSort) Missing(missing interface{}) FieldSort {
	s.missing = missing
	return s
}
func (s FieldSort) IgnoreUnmapped(ignoreUnmapped bool) FieldSort {
	s.ignoreUnmapped = &ignoreUnmapped
	return s
}
func (s FieldSort) UnmappedType(typ string) FieldSort {
	s.unmappedType = &typ
	return s
}
func (s FieldSort) SortMode(sortMode string) FieldSort {
	s.sortMode = &sortMode
	return s
}
func (s FieldSort) NestedFilter(nestedFilter Query) FieldSort {
	s.nestedFilter = nestedFilter
	return s
}
func (s FieldSort) NestedPath(nestedPath string) FieldSort {
	s.nestedPath = &nestedPath
	return s
}