func (s *AliasService) Add(indexName string, aliasName string) *AliasService {
	action := NewAliasAddAction(aliasName).Index(indexName)
	s.actions = append(s.actions, action)
	return s
}
Add adds an alias to an index.
package elastic
import (
	"context"
	"fmt"
	"net/url"
	"strings"
)
type AliasAction interface {
	Source() (interface{}, error)
}
type AliasAddAction struct {
	index         []string  
	alias         string    
	filter        Query
	routing       string
	searchRouting string
	indexRouting  string
}
func NewAliasAddAction(alias string) *AliasAddAction {
	return &AliasAddAction{
		alias: alias,
	}
}
func (a *AliasAddAction) Index(index ...string) *AliasAddAction {
	a.index = append(a.index, index...)
	return a
}
func (a *AliasAddAction) removeBlankIndexNames() {
	var indices []string
	for _, index := range a.index {
		if len(index) > 0 {
			indices = append(indices, index)
		}
	}
	a.index = indices
}
func (a *AliasAddAction) Filter(filter Query) *AliasAddAction {
	a.filter = filter
	return a
}
func (a *AliasAddAction) Routing(routing string) *AliasAddAction {
	a.routing = routing
	return a
}
func (a *AliasAddAction) IndexRouting(routing string) *AliasAddAction {
	a.indexRouting = routing
	return a
}
func (a *AliasAddAction) SearchRouting(routing ...string) *AliasAddAction {
	a.searchRouting = strings.Join(routing, ",")
	return a
}
func (a *AliasAddAction) Validate() error {
	var invalid []string
	if len(a.alias) == 0 {
		invalid = append(invalid, "Alias")
	}
	if len(a.index) == 0 {
		invalid = append(invalid, "Index")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
func (a *AliasAddAction) Source() (interface{}, error) {
	a.removeBlankIndexNames()
	if err := a.Validate(); err != nil {
		return nil, err
	}
	src := make(map[string]interface{})
	act := make(map[string]interface{})
	src["add"] = act
	act["alias"] = a.alias
	switch len(a.index) {
	case 1:
		act["index"] = a.index[0]
	default:
		act["indices"] = a.index
	}
	if a.filter != nil {
		f, err := a.filter.Source()
		if err != nil {
			return nil, err
		}
		act["filter"] = f
	}
	if len(a.routing) > 0 {
		act["routing"] = a.routing
	}
	if len(a.indexRouting) > 0 {
		act["index_routing"] = a.indexRouting
	}
	if len(a.searchRouting) > 0 {
		act["search_routing"] = a.searchRouting
	}
	return src, nil
}
type AliasRemoveAction struct {
	index []string  
	alias string    
}
func NewAliasRemoveAction(alias string) *AliasRemoveAction {
	return &AliasRemoveAction{
		alias: alias,
	}
}
func (a *AliasRemoveAction) Index(index ...string) *AliasRemoveAction {
	a.index = append(a.index, index...)
	return a
}
func (a *AliasRemoveAction) removeBlankIndexNames() {
	var indices []string
	for _, index := range a.index {
		if len(index) > 0 {
			indices = append(indices, index)
		}
	}
	a.index = indices
}
func (a *AliasRemoveAction) Validate() error {
	var invalid []string
	if len(a.alias) == 0 {
		invalid = append(invalid, "Alias")
	}
	if len(a.index) == 0 {
		invalid = append(invalid, "Index")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
func (a *AliasRemoveAction) Source() (interface{}, error) {
	a.removeBlankIndexNames()
	if err := a.Validate(); err != nil {
		return nil, err
	}
	src := make(map[string]interface{})
	act := make(map[string]interface{})
	src["remove"] = act
	act["alias"] = a.alias
	switch len(a.index) {
	case 1:
		act["index"] = a.index[0]
	default:
		act["indices"] = a.index
	}
	return src, nil
}
type AliasService struct {
	client  *Client
	actions []AliasAction
	pretty  bool
}
func NewAliasService(client *Client) *AliasService {
	builder := &AliasService{
		client: client,
	}
	return builder
}
func (s *AliasService) Pretty(pretty bool) *AliasService {
	s.pretty = pretty
	return s
}