code: func (s *ScriptSort) Source() (interface{}, error) {
  	if s.script == nil {
  		return nil, errors.New("ScriptSort expected a script")
  	}
  	source := make(map[string]interface{})
  	x := make(map[string]interface{})
  	source["_script"] = x
  
  	src, err := s.script.Source()
  	if err != nil {
  		return nil, err
  	}
  	x["script"] = src
  
  	x["type"] = s.typ
  
  	if s.ascending {
  		x["order"] = "asc"
  	} else {
  		x["order"] = "desc"
  	}
  	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
  }
docs: // Source returns the JSON-serializable data.