func (s *IndicesCloseService) Do(ctx context.Context) (*IndicesCloseResponse, error) {
	if err := s.Validate(); err != nil {
		return nil, err
	}
	path, params, err := s.buildURL()
	if err != nil {
		return nil, err
	}
	res, err := s.client.PerformRequest(ctx, "POST", path, params, nil)
	if err != nil {
		return nil, err
	}
	ret := new(IndicesCloseResponse)
	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 IndicesCloseService struct {
	client            *Client
	pretty            bool
	index             string
	timeout           string
	masterTimeout     string
	ignoreUnavailable *bool
	allowNoIndices    *bool
	expandWildcards   string
}
func NewIndicesCloseService(client *Client) *IndicesCloseService {
	return &IndicesCloseService{client: client}
}
func (s *IndicesCloseService) Index(index string) *IndicesCloseService {
	s.index = index
	return s
}
func (s *IndicesCloseService) Timeout(timeout string) *IndicesCloseService {
	s.timeout = timeout
	return s
}
func (s *IndicesCloseService) MasterTimeout(masterTimeout string) *IndicesCloseService {
	s.masterTimeout = masterTimeout
	return s
}
func (s *IndicesCloseService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesCloseService {
	s.ignoreUnavailable = &ignoreUnavailable
	return s
}
func (s *IndicesCloseService) AllowNoIndices(allowNoIndices bool) *IndicesCloseService {
	s.allowNoIndices = &allowNoIndices
	return s
}
func (s *IndicesCloseService) ExpandWildcards(expandWildcards string) *IndicesCloseService {
	s.expandWildcards = expandWildcards
	return s
}
func (s *IndicesCloseService) Pretty(pretty bool) *IndicesCloseService {
	s.pretty = pretty
	return s
}
func (s *IndicesCloseService) buildURL() (string, url.Values, error) {
	path, err := uritemplates.Expand("/{index}/_close", map[string]string{
		"index": s.index,
	})
	if err != nil {
		return "", url.Values{}, err
	}
	params := url.Values{}
	if s.allowNoIndices != nil {
		params.Set("allow_no_indices", fmt.Sprintf("%v", *s.allowNoIndices))
	}
	if s.expandWildcards != "" {
		params.Set("expand_wildcards", s.expandWildcards)
	}
	if s.timeout != "" {
		params.Set("timeout", s.timeout)
	}
	if s.masterTimeout != "" {
		params.Set("master_timeout", s.masterTimeout)
	}
	if s.ignoreUnavailable != nil {
		params.Set("ignore_unavailable", fmt.Sprintf("%v", *s.ignoreUnavailable))
	}
	return path, params, nil
}
func (s *IndicesCloseService) Validate() error {
	var invalid []string
	if s.index == "" {
		invalid = append(invalid, "Index")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}