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.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
	}
	if s.nestedSort != nil {
		src, err := s.nestedSort.Source()
		if err != nil {
			return nil, err
		}
		x["nested"] = src
	}
	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
	UnmappedType   string
	SortMode       string
	NestedFilter   Query
	NestedPath     string
	NestedSort     *NestedSort  
}
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.UnmappedType != "" {
		prop["unmapped_type"] = info.UnmappedType
	}
	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
	}
	if info.NestedSort != nil {
		src, err := info.NestedSort.Source()
		if err != nil {
			return nil, err
		}
		prop["nested"] = src
	}
	source := make(map[string]interface{})
	source[info.Field] = prop
	return source, nil
}
type SortByDoc struct {
	Sorter
}
func (s SortByDoc) Source() (interface{}, error) {
	return "_doc", 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["order"] = "asc"
	} else {
		x["order"] = "desc"
	}
	return source, nil
}
type FieldSort struct {
	Sorter
	fieldName    string
	ascending    bool
	missing      interface{}
	unmappedType *string
	sortMode     *string
	nestedFilter Query
	nestedPath   *string
	nestedSort   *NestedSort
}
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) 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
}
func (s *FieldSort) NestedSort(nestedSort *NestedSort) *FieldSort {
	s.nestedSort = nestedSort
	return s
}