func (q *SimpleQueryStringQuery) Source() (interface{}, error) {
	source := make(map[string]interface{})
	query := make(map[string]interface{})
	source["simple_query_string"] = query
	query["query"] = q.queryText
	if len(q.fields) > 0 {
		var fields []string
		for _, field := range q.fields {
			if boost, found := q.fieldBoosts[field]; found {
				if boost != nil {
					fields = append(fields, fmt.Sprintf("%s^%f", field, *boost))
				} else {
					fields = append(fields, field)
				}
			} else {
				fields = append(fields, field)
			}
		}
		query["fields"] = fields
	}
	if q.flags != "" {
		query["flags"] = q.flags
	}
	if q.analyzer != "" {
		query["analyzer"] = q.analyzer
	}
	if q.defaultOperator != "" {
		query["default_operator"] = strings.ToLower(q.defaultOperator)
	}
	if q.lowercaseExpandedTerms != nil {
		query["lowercase_expanded_terms"] = *q.lowercaseExpandedTerms
	}
	if q.lenient != nil {
		query["lenient"] = *q.lenient
	}
	if q.analyzeWildcard != nil {
		query["analyze_wildcard"] = *q.analyzeWildcard
	}
	if q.locale != "" {
		query["locale"] = q.locale
	}
	if q.queryName != "" {
		query["_name"] = q.queryName
	}
	if q.minimumShouldMatch != "" {
		query["minimum_should_match"] = q.minimumShouldMatch
	}
	if q.quoteFieldSuffix != "" {
		query["quote_field_suffix"] = q.quoteFieldSuffix
	}
	if q.boost != nil {
		query["boost"] = *q.boost
	}
	if v := q.autoGenerateSynonymsPhraseQuery; v != nil {
		query["auto_generate_synonyms_phrase_query"] = *v
	}
	if v := q.fuzzyPrefixLength; v != -1 {
		query["fuzzy_prefix_length"] = v
	}
	if v := q.fuzzyMaxExpansions; v != -1 {
		query["fuzzy_max_expansions"] = v
	}
	if v := q.fuzzyTranspositions; v != nil {
		query["fuzzy_transpositions"] = *v
	}
	return source, nil
}
Source returns JSON for the query.
package elastic
import (
	"fmt"
	"strings"
)
type SimpleQueryStringQuery struct {
	queryText                       string
	analyzer                        string
	quoteFieldSuffix                string
	defaultOperator                 string
	fields                          []string
	fieldBoosts                     map[string]*float64
	minimumShouldMatch              string
	flags                           string
	boost                           *float64
	lowercaseExpandedTerms          *bool  
	lenient                         *bool
	analyzeWildcard                 *bool
	locale                          string  
	queryName                       string
	autoGenerateSynonymsPhraseQuery *bool
	fuzzyPrefixLength               int
	fuzzyMaxExpansions              int
	fuzzyTranspositions             *bool
}
func NewSimpleQueryStringQuery(text string) *SimpleQueryStringQuery {
	return &SimpleQueryStringQuery{
		queryText:          text,
		fields:             make([]string, 0),
		fieldBoosts:        make(map[string]*float64),
		fuzzyPrefixLength:  -1,
		fuzzyMaxExpansions: -1,
	}
}
func (q *SimpleQueryStringQuery) Field(field string) *SimpleQueryStringQuery {
	q.fields = append(q.fields, field)
	return q
}
func (q *SimpleQueryStringQuery) FieldWithBoost(field string, boost float64) *SimpleQueryStringQuery {
	q.fields = append(q.fields, field)
	q.fieldBoosts[field] = &boost
	return q
}
func (q *SimpleQueryStringQuery) Boost(boost float64) *SimpleQueryStringQuery {
	q.boost = &boost
	return q
}
func (q *SimpleQueryStringQuery) QuoteFieldSuffix(quoteFieldSuffix string) *SimpleQueryStringQuery {
	q.quoteFieldSuffix = quoteFieldSuffix
	return q
}
func (q *SimpleQueryStringQuery) QueryName(queryName string) *SimpleQueryStringQuery {
	q.queryName = queryName
	return q
}
func (q *SimpleQueryStringQuery) Analyzer(analyzer string) *SimpleQueryStringQuery {
	q.analyzer = analyzer
	return q
}
func (q *SimpleQueryStringQuery) DefaultOperator(defaultOperator string) *SimpleQueryStringQuery {
	q.defaultOperator = defaultOperator
	return q
}
func (q *SimpleQueryStringQuery) Flags(flags string) *SimpleQueryStringQuery {
	q.flags = flags
	return q
}
func (q *SimpleQueryStringQuery) LowercaseExpandedTerms(lowercaseExpandedTerms bool) *SimpleQueryStringQuery {
	q.lowercaseExpandedTerms = &lowercaseExpandedTerms
	return q
}
func (q *SimpleQueryStringQuery) Locale(locale string) *SimpleQueryStringQuery {
	q.locale = locale
	return q
}
func (q *SimpleQueryStringQuery) Lenient(lenient bool) *SimpleQueryStringQuery {
	q.lenient = &lenient
	return q
}
func (q *SimpleQueryStringQuery) AnalyzeWildcard(analyzeWildcard bool) *SimpleQueryStringQuery {
	q.analyzeWildcard = &analyzeWildcard
	return q
}
func (q *SimpleQueryStringQuery) MinimumShouldMatch(minimumShouldMatch string) *SimpleQueryStringQuery {
	q.minimumShouldMatch = minimumShouldMatch
	return q
}
func (q *SimpleQueryStringQuery) AutoGenerateSynonymsPhraseQuery(enable bool) *SimpleQueryStringQuery {
	q.autoGenerateSynonymsPhraseQuery = &enable
	return q
}
func (q *SimpleQueryStringQuery) FuzzyPrefixLength(fuzzyPrefixLength int) *SimpleQueryStringQuery {
	q.fuzzyPrefixLength = fuzzyPrefixLength
	return q
}
func (q *SimpleQueryStringQuery) FuzzyMaxExpansions(fuzzyMaxExpansions int) *SimpleQueryStringQuery {
	q.fuzzyMaxExpansions = fuzzyMaxExpansions
	return q
}
func (q *SimpleQueryStringQuery) FuzzyTranspositions(fuzzyTranspositions bool) *SimpleQueryStringQuery {
	q.fuzzyTranspositions = &fuzzyTranspositions
	return q
}