diff options
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all.go')
-rw-r--r-- | vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all.go index d681ba237..5551eea30 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all.go +++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all.go @@ -10,7 +10,8 @@ package elastic // For more details, see // https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-match-all-query.html type MatchAllQuery struct { - boost *float64 + boost *float64 + queryName string } // NewMatchAllQuery creates and initializes a new match all query. @@ -26,7 +27,13 @@ func (q *MatchAllQuery) Boost(boost float64) *MatchAllQuery { return q } -// Source returns JSON for the function score query. +// QueryName sets the query name. +func (q *MatchAllQuery) QueryName(name string) *MatchAllQuery { + q.queryName = name + return q +} + +// Source returns JSON for the match all query. func (q MatchAllQuery) Source() (interface{}, error) { // { // "match_all" : { ... } @@ -37,5 +44,8 @@ func (q MatchAllQuery) Source() (interface{}, error) { if q.boost != nil { params["boost"] = *q.boost } + if q.queryName != "" { + params["_name"] = q.queryName + } return source, nil } |