func (s *PutTemplateService) Do(ctx context.Context) (*AcknowledgedResponse, error) {
	if err := s.Validate(); err != nil {
		return nil, err
	}
	path, params, err := s.buildURL()
	if err != nil {
		return nil, err
	}
	var body interface{}
	if s.bodyJson != nil {
		body = s.bodyJson
	} else {
		body = s.bodyString
	}
	res, err := s.client.PerformRequest(ctx, "PUT", path, params, body)
	if err != nil {
		return nil, err
	}
	ret := new(AcknowledgedResponse)
	if err := s.client.decoder.Decode(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
Do executes the operation.
package elastic
import (
	"context"
	"fmt"
	"net/url"
	"gopkg.in/olivere/elastic.v5/uritemplates"
)
type PutTemplateService struct {
	client      *Client
	pretty      bool
	id          string
	opType      string
	version     *int
	versionType string
	bodyJson    interface{}
	bodyString  string
}
func NewPutTemplateService(client *Client) *PutTemplateService {
	return &PutTemplateService{
		client: client,
	}
}
func (s *PutTemplateService) Id(id string) *PutTemplateService {
	s.id = id
	return s
}
func (s *PutTemplateService) OpType(opType string) *PutTemplateService {
	s.opType = opType
	return s
}
func (s *PutTemplateService) Version(version int) *PutTemplateService {
	s.version = &version
	return s
}
func (s *PutTemplateService) VersionType(versionType string) *PutTemplateService {
	s.versionType = versionType
	return s
}
func (s *PutTemplateService) BodyJson(body interface{}) *PutTemplateService {
	s.bodyJson = body
	return s
}
func (s *PutTemplateService) BodyString(body string) *PutTemplateService {
	s.bodyString = body
	return s
}
func (s *PutTemplateService) buildURL() (string, url.Values, error) {
	path, err := uritemplates.Expand("/_search/template/{id}", map[string]string{
		"id": s.id,
	})
	if err != nil {
		return "", url.Values{}, err
	}
	params := url.Values{}
	if s.version != nil {
		params.Set("version", fmt.Sprintf("%d", *s.version))
	}
	if s.versionType != "" {
		params.Set("version_type", s.versionType)
	}
	if s.opType != "" {
		params.Set("op_type", s.opType)
	}
	return path, params, nil
}
func (s *PutTemplateService) Validate() error {
	var invalid []string
	if s.id == "" {
		invalid = append(invalid, "Id")
	}
	if s.bodyString == "" && s.bodyJson == nil {
		invalid = append(invalid, "BodyJson")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}