func (res DeleteByQueryResult) IndexNames() []string {
	var indices []string
	for index, _ := range res.Indices {
		indices = append(indices, index)
	}
	return indices
}
IndexNames returns the names of the indices the DeleteByQuery touched.
package elastic
import (
	"fmt"
	"net/url"
	"strings"
	"gopkg.in/olivere/elastic.v3/uritemplates"
)
type DeleteByQueryService struct {
	client            *Client
	indices           []string
	types             []string
	analyzer          string
	consistency       string
	defaultOper       string
	df                string
	ignoreUnavailable *bool
	allowNoIndices    *bool
	expandWildcards   string
	replication       string
	routing           string
	timeout           string
	pretty            bool
	q                 string
	query             Query
}
func NewDeleteByQueryService(client *Client) *DeleteByQueryService {
	builder := &DeleteByQueryService{
		client: client,
	}
	return builder
}
func (s *DeleteByQueryService) Index(indices ...string) *DeleteByQueryService {
	if s.indices == nil {
		s.indices = make([]string, 0)
	}
	s.indices = append(s.indices, indices...)
	return s
}
func (s *DeleteByQueryService) Type(types ...string) *DeleteByQueryService {
	if s.types == nil {
		s.types = make([]string, 0)
	}
	s.types = append(s.types, types...)
	return s
}
func (s *DeleteByQueryService) Analyzer(analyzer string) *DeleteByQueryService {
	s.analyzer = analyzer
	return s
}
func (s *DeleteByQueryService) Consistency(consistency string) *DeleteByQueryService {
	s.consistency = consistency
	return s
}
func (s *DeleteByQueryService) DefaultOperator(defaultOperator string) *DeleteByQueryService {
	s.defaultOper = defaultOperator
	return s
}
func (s *DeleteByQueryService) DF(defaultField string) *DeleteByQueryService {
	s.df = defaultField
	return s
}
func (s *DeleteByQueryService) DefaultField(defaultField string) *DeleteByQueryService {
	s.df = defaultField
	return s
}
func (s *DeleteByQueryService) IgnoreUnavailable(ignore bool) *DeleteByQueryService {
	s.ignoreUnavailable = &ignore
	return s
}
func (s *DeleteByQueryService) AllowNoIndices(allow bool) *DeleteByQueryService {
	s.allowNoIndices = &allow
	return s
}
func (s *DeleteByQueryService) ExpandWildcards(expand string) *DeleteByQueryService {
	s.expandWildcards = expand
	return s
}
func (s *DeleteByQueryService) Replication(replication string) *DeleteByQueryService {
	s.replication = replication
	return s
}
func (s *DeleteByQueryService) Q(query string) *DeleteByQueryService {
	s.q = query
	return s
}
func (s *DeleteByQueryService) QueryString(query string) *DeleteByQueryService {
	s.q = query
	return s
}
func (s *DeleteByQueryService) Routing(routing string) *DeleteByQueryService {
	s.routing = routing
	return s
}
func (s *DeleteByQueryService) Timeout(timeout string) *DeleteByQueryService {
	s.timeout = timeout
	return s
}
func (s *DeleteByQueryService) Pretty(pretty bool) *DeleteByQueryService {
	s.pretty = pretty
	return s
}
func (s *DeleteByQueryService) Query(query Query) *DeleteByQueryService {
	s.query = query
	return s
}
func (s *DeleteByQueryService) Do() (*DeleteByQueryResult, error) {
	var err error
	path := "/"
	indexPart := make([]string, 0)
	for _, index := range s.indices {
		index, err = uritemplates.Expand("{index}", map[string]string{
			"index": index,
		})
		if err != nil {
			return nil, err
		}
		indexPart = append(indexPart, index)
	}
	if len(indexPart) > 0 {
		path += strings.Join(indexPart, ",")
	}
	typesPart := make([]string, 0)
	for _, typ := range s.types {
		typ, err = uritemplates.Expand("{type}", map[string]string{
			"type": typ,
		})
		if err != nil {
			return nil, err
		}
		typesPart = append(typesPart, typ)
	}
	if len(typesPart) > 0 {
		path += "/" + strings.Join(typesPart, ",")
	}
	path += "/_query"
	params := make(url.Values)
	if s.analyzer != "" {
		params.Set("analyzer", s.analyzer)
	}
	if s.consistency != "" {
		params.Set("consistency", s.consistency)
	}
	if s.defaultOper != "" {
		params.Set("default_operator", s.defaultOper)
	}
	if s.df != "" {
		params.Set("df", s.df)
	}
	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)
	}
	if s.replication != "" {
		params.Set("replication", s.replication)
	}
	if s.routing != "" {
		params.Set("routing", s.routing)
	}
	if s.timeout != "" {
		params.Set("timeout", s.timeout)
	}
	if s.pretty {
		params.Set("pretty", fmt.Sprintf("%v", s.pretty))
	}
	if s.q != "" {
		params.Set("q", s.q)
	}
	var body interface{}
	if s.query != nil {
		src, err := s.query.Source()
		if err != nil {
			return nil, err
		}
		query := make(map[string]interface{})
		query["query"] = src
		body = query
	}
	res, err := s.client.PerformRequest("DELETE", path, params, body)
	if err != nil {
		return nil, err
	}
	ret := new(DeleteByQueryResult)
	if err := s.client.decoder.Decode(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
type DeleteByQueryResult struct {
	Took     int64                               `json:"took"`
	TimedOut bool                                `json:"timed_out"`
	Indices  map[string]IndexDeleteByQueryResult `json:"_indices"`
	Failures []shardOperationFailure             `json:"failures"`
}