func (s *PercolateService) Do() (*PercolateResponse, 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("GET", path, params, body)
	if err != nil {
		return nil, err
	}
	ret := new(PercolateResponse)
	if err := s.client.decoder.Decode(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
Do executes the operation.
package elastic
import (
	"fmt"
	"net/url"
	"strings"
	"gopkg.in/olivere/elastic.v3/uritemplates"
)
type PercolateService struct {
	client              *Client
	pretty              bool
	index               string
	typ                 string
	id                  string
	version             interface{}
	versionType         string
	routing             []string
	preference          string
	ignoreUnavailable   *bool
	percolateIndex      string
	percolatePreference string
	percolateRouting    string
	source              string
	allowNoIndices      *bool
	expandWildcards     string
	percolateFormat     string
	percolateType       string
	bodyJson            interface{}
	bodyString          string
}
func NewPercolateService(client *Client) *PercolateService {
	return &PercolateService{
		client:  client,
		routing: make([]string, 0),
	}
}
func (s *PercolateService) Index(index string) *PercolateService {
	s.index = index
	return s
}
func (s *PercolateService) Type(typ string) *PercolateService {
	s.typ = typ
	return s
}
func (s *PercolateService) Id(id string) *PercolateService {
	s.id = id
	return s
}
func (s *PercolateService) ExpandWildcards(expandWildcards string) *PercolateService {
	s.expandWildcards = expandWildcards
	return s
}
func (s *PercolateService) PercolateFormat(percolateFormat string) *PercolateService {
	s.percolateFormat = percolateFormat
	return s
}
func (s *PercolateService) PercolateType(percolateType string) *PercolateService {
	s.percolateType = percolateType
	return s
}
func (s *PercolateService) PercolateRouting(percolateRouting string) *PercolateService {
	s.percolateRouting = percolateRouting
	return s
}
func (s *PercolateService) Source(source string) *PercolateService {
	s.source = source
	return s
}
func (s *PercolateService) AllowNoIndices(allowNoIndices bool) *PercolateService {
	s.allowNoIndices = &allowNoIndices
	return s
}
func (s *PercolateService) IgnoreUnavailable(ignoreUnavailable bool) *PercolateService {
	s.ignoreUnavailable = &ignoreUnavailable
	return s
}
func (s *PercolateService) PercolateIndex(percolateIndex string) *PercolateService {
	s.percolateIndex = percolateIndex
	return s
}
func (s *PercolateService) PercolatePreference(percolatePreference string) *PercolateService {
	s.percolatePreference = percolatePreference
	return s
}
func (s *PercolateService) Version(version interface{}) *PercolateService {
	s.version = version
	return s
}
func (s *PercolateService) VersionType(versionType string) *PercolateService {
	s.versionType = versionType
	return s
}
func (s *PercolateService) Routing(routing []string) *PercolateService {
	s.routing = routing
	return s
}
func (s *PercolateService) Preference(preference string) *PercolateService {
	s.preference = preference
	return s
}
func (s *PercolateService) Pretty(pretty bool) *PercolateService {
	s.pretty = pretty
	return s
}
func (s *PercolateService) Doc(doc interface{}) *PercolateService {
	return s.BodyJson(map[string]interface{}{"doc": doc})
}
func (s *PercolateService) BodyJson(body interface{}) *PercolateService {
	s.bodyJson = body
	return s
}
func (s *PercolateService) BodyString(body string) *PercolateService {
	s.bodyString = body
	return s
}
func (s *PercolateService) buildURL() (string, url.Values, error) {
	var path string
	var err error
	if s.id == "" {
		path, err = uritemplates.Expand("/{index}/{type}/_percolate", map[string]string{
			"index": s.index,
			"type":  s.typ,
		})
	} else {
		path, err = uritemplates.Expand("/{index}/{type}/{id}/_percolate", map[string]string{
			"index": s.index,
			"type":  s.typ,
			"id":    s.id,
		})
	}
	if err != nil {
		return "", url.Values{}, err
	}
	params := url.Values{}
	if s.pretty {
		params.Set("pretty", "1")
	}
	if s.version != nil {
		params.Set("version", fmt.Sprintf("%v", s.version))
	}
	if s.versionType != "" {
		params.Set("version_type", s.versionType)
	}
	if len(s.routing) > 0 {
		params.Set("routing", strings.Join(s.routing, ","))
	}
	if s.preference != "" {
		params.Set("preference", s.preference)
	}
	if s.ignoreUnavailable != nil {
		params.Set("ignore_unavailable", fmt.Sprintf("%v", *s.ignoreUnavailable))
	}
	if s.percolateIndex != "" {
		params.Set("percolate_index", s.percolateIndex)
	}
	if s.percolatePreference != "" {
		params.Set("percolate_preference", s.percolatePreference)
	}
	if s.percolateRouting != "" {
		params.Set("percolate_routing", s.percolateRouting)
	}
	if s.source != "" {
		params.Set("source", s.source)
	}
	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.percolateFormat != "" {
		params.Set("percolate_format", s.percolateFormat)
	}
	if s.percolateType != "" {
		params.Set("percolate_type", s.percolateType)
	}
	return path, params, nil
}
func (s *PercolateService) Validate() error {
	var invalid []string
	if s.index == "" {
		invalid = append(invalid, "Index")
	}
	if s.typ == "" {
		invalid = append(invalid, "Type")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}