func (s *IndicesExistsService) 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},
		Headers:      s.headers,
	})
	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"
	"strings"
	"github.com/olivere/elastic/v7/uritemplates"
)
type IndicesExistsService struct {
	client *Client
	pretty     *bool        
	human      *bool        
	errorTrace *bool        
	filterPath []string     
	headers    http.Header  
	index             []string
	ignoreUnavailable *bool
	allowNoIndices    *bool
	expandWildcards   string
	local             *bool
}
func NewIndicesExistsService(client *Client) *IndicesExistsService {
	return &IndicesExistsService{
		client: client,
		index:  make([]string, 0),
	}
}
func (s *IndicesExistsService) Pretty(pretty bool) *IndicesExistsService {
	s.pretty = &pretty
	return s
}
func (s *IndicesExistsService) Human(human bool) *IndicesExistsService {
	s.human = &human
	return s
}
func (s *IndicesExistsService) ErrorTrace(errorTrace bool) *IndicesExistsService {
	s.errorTrace = &errorTrace
	return s
}
func (s *IndicesExistsService) FilterPath(filterPath ...string) *IndicesExistsService {
	s.filterPath = filterPath
	return s
}
func (s *IndicesExistsService) Header(name string, value string) *IndicesExistsService {
	if s.headers == nil {
		s.headers = http.Header{}
	}
	s.headers.Add(name, value)
	return s
}
func (s *IndicesExistsService) Headers(headers http.Header) *IndicesExistsService {
	s.headers = headers
	return s
}
func (s *IndicesExistsService) Index(index []string) *IndicesExistsService {
	s.index = index
	return s
}
func (s *IndicesExistsService) AllowNoIndices(allowNoIndices bool) *IndicesExistsService {
	s.allowNoIndices = &allowNoIndices
	return s
}
func (s *IndicesExistsService) ExpandWildcards(expandWildcards string) *IndicesExistsService {
	s.expandWildcards = expandWildcards
	return s
}
func (s *IndicesExistsService) Local(local bool) *IndicesExistsService {
	s.local = &local
	return s
}
func (s *IndicesExistsService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesExistsService {
	s.ignoreUnavailable = &ignoreUnavailable
	return s
}
func (s *IndicesExistsService) buildURL() (string, url.Values, error) {
	path, err := uritemplates.Expand("/{index}", map[string]string{
		"index": strings.Join(s.index, ","),
	})
	if err != nil {
		return "", url.Values{}, err
	}
	params := url.Values{}
	if v := s.pretty; v != nil {
		params.Set("pretty", fmt.Sprint(*v))
	}
	if v := s.human; v != nil {
		params.Set("human", fmt.Sprint(*v))
	}
	if v := s.errorTrace; v != nil {
		params.Set("error_trace", fmt.Sprint(*v))
	}
	if len(s.filterPath) > 0 {
		params.Set("filter_path", strings.Join(s.filterPath, ","))
	}
	if s.local != nil {
		params.Set("local", fmt.Sprintf("%v", *s.local))
	}
	if s.ignoreUnavailable != nil {
		params.Set("ignore_unavailable", fmt.Sprintf("%v", *s.ignoreUnavailable))
	}
	if s.allowNoIndices != nil {
		params.Set("allow_no_indices", fmt.Sprintf("%v", *s.allowNoIndices))
	}
	if s.expandWildcards != "" {
		params.Set("expand_wildcards", s.expandWildcards)
	}
	return path, params, nil
}
func (s *IndicesExistsService) Validate() error {
	var invalid []string
	if len(s.index) == 0 {
		invalid = append(invalid, "Index")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}