func (s *IndicesExistsTemplateService) Do(ctx context.Context) (bool, error) {
	if err := s.Validate(); err != nil {
		return false, err
	}
	path, params, err := s.buildURL()
	if err != nil {
		return false, err
	}
	res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
		Method:       "HEAD",
		Path:         path,
		Params:       params,
		IgnoreErrors: []int{404},
	})
	if err != nil {
		return false, err
	}
	switch res.StatusCode {
	case http.StatusOK:
		return true, nil
	case http.StatusNotFound:
		return false, nil
	default:
		return false, fmt.Errorf("elastic: got HTTP code %d when it should have been either 200 or 404", res.StatusCode)
	}
}
Do executes the operation.
package elastic
import (
	"context"
	"fmt"
	"net/http"
	"net/url"
	"github.com/olivere/elastic/uritemplates"
)
type IndicesExistsTemplateService struct {
	client *Client
	pretty bool
	name   string
	local  *bool
}
func NewIndicesExistsTemplateService(client *Client) *IndicesExistsTemplateService {
	return &IndicesExistsTemplateService{
		client: client,
	}
}
func (s *IndicesExistsTemplateService) Name(name string) *IndicesExistsTemplateService {
	s.name = name
	return s
}
func (s *IndicesExistsTemplateService) Local(local bool) *IndicesExistsTemplateService {
	s.local = &local
	return s
}
func (s *IndicesExistsTemplateService) Pretty(pretty bool) *IndicesExistsTemplateService {
	s.pretty = pretty
	return s
}
func (s *IndicesExistsTemplateService) buildURL() (string, url.Values, error) {
	path, err := uritemplates.Expand("/_template/{name}", map[string]string{
		"name": s.name,
	})
	if err != nil {
		return "", url.Values{}, err
	}
	params := url.Values{}
	if s.pretty {
		params.Set("pretty", "true")
	}
	if s.local != nil {
		params.Set("local", fmt.Sprintf("%v", *s.local))
	}
	return path, params, nil
}
func (s *IndicesExistsTemplateService) Validate() error {
	var invalid []string
	if s.name == "" {
		invalid = append(invalid, "Name")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}