func (item *MultiGetItem) Source() (interface{}, error) {
	source := make(map[string]interface{})
	source["_id"] = item.id
	if item.index != "" {
		source["_index"] = item.index
	}
	if item.typ != "" {
		source["_type"] = item.typ
	}
	if item.fsc != nil {
		src, err := item.fsc.Source()
		if err != nil {
			return nil, err
		}
		source["_source"] = src
	}
	if item.routing != "" {
		source["_routing"] = item.routing
	}
	if len(item.storedFields) > 0 {
		source["stored_fields"] = strings.Join(item.storedFields, ",")
	}
	if item.version != nil {
		source["version"] = fmt.Sprintf("%d", *item.version)
	}
	if item.versionType != "" {
		source["version_type"] = item.versionType
	}
	return source, nil
}
Source returns the serialized JSON to be sent to Elasticsearch as
part of a MultiGet search.
package elastic
import (
	"context"
	"fmt"
	"net/url"
	"strings"
)
type MgetService struct {
	client       *Client
	pretty       bool
	preference   string
	realtime     *bool
	refresh      string
	routing      string
	storedFields []string
	items        []*MultiGetItem
}
func NewMgetService(client *Client) *MgetService {
	builder := &MgetService{
		client: client,
	}
	return builder
}
func (s *MgetService) Preference(preference string) *MgetService {
	s.preference = preference
	return s
}
func (s *MgetService) Refresh(refresh string) *MgetService {
	s.refresh = refresh
	return s
}
func (s *MgetService) Realtime(realtime bool) *MgetService {
	s.realtime = &realtime
	return s
}
func (s *MgetService) Routing(routing string) *MgetService {
	s.routing = routing
	return s
}
func (s *MgetService) StoredFields(storedFields ...string) *MgetService {
	s.storedFields = append(s.storedFields, storedFields...)
	return s
}
func (s *MgetService) Pretty(pretty bool) *MgetService {
	s.pretty = pretty
	return s
}
func (s *MgetService) Add(items ...*MultiGetItem) *MgetService {
	s.items = append(s.items, items...)
	return s
}
func (s *MgetService) Source() (interface{}, error) {
	source := make(map[string]interface{})
	items := make([]interface{}, len(s.items))
	for i, item := range s.items {
		src, err := item.Source()
		if err != nil {
			return nil, err
		}
		items[i] = src
	}
	source["docs"] = items
	return source, nil
}
func (s *MgetService) Do(ctx context.Context) (*MgetResponse, error) {
	path := "/_mget"
	params := make(url.Values)
	if s.realtime != nil {
		params.Add("realtime", fmt.Sprintf("%v", *s.realtime))
	}
	if s.preference != "" {
		params.Add("preference", s.preference)
	}
	if s.refresh != "" {
		params.Add("refresh", s.refresh)
	}
	if s.routing != "" {
		params.Set("routing", s.routing)
	}
	if len(s.storedFields) > 0 {
		params.Set("stored_fields", strings.Join(s.storedFields, ","))
	}
	body, err := s.Source()
	if err != nil {
		return nil, err
	}
	res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
		Method: "GET",
		Path:   path,
		Params: params,
		Body:   body,
	})
	if err != nil {
		return nil, err
	}
	ret := new(MgetResponse)
	if err := s.client.decoder.Decode(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
type MultiGetItem struct {
	index        string
	typ          string
	id           string
	routing      string
	storedFields []string
	version      *int64  
	versionType  string  
	fsc          *FetchSourceContext
}
func NewMultiGetItem() *MultiGetItem {
	return &MultiGetItem{}
}
func (item *MultiGetItem) Index(index string) *MultiGetItem {
	item.index = index
	return item
}
func (item *MultiGetItem) Type(typ string) *MultiGetItem {
	item.typ = typ
	return item
}
func (item *MultiGetItem) Id(id string) *MultiGetItem {
	item.id = id
	return item
}
func (item *MultiGetItem) Routing(routing string) *MultiGetItem {
	item.routing = routing
	return item
}
func (item *MultiGetItem) StoredFields(storedFields ...string) *MultiGetItem {
	item.storedFields = append(item.storedFields, storedFields...)
	return item
}
func (item *MultiGetItem) Version(version int64) *MultiGetItem {
	item.version = &version
	return item
}
func (item *MultiGetItem) VersionType(versionType string) *MultiGetItem {
	item.versionType = versionType
	return item
}
func (item *MultiGetItem) FetchSource(fetchSourceContext *FetchSourceContext) *MultiGetItem {
	item.fsc = fetchSourceContext
	return item
}