diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-07-20 15:22:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-20 15:22:49 -0700 |
commit | 58839cefb50e56ae5b157b37e9814ae83ceee70b (patch) | |
tree | 5de966481678096fc9567f74f96673b34a65127c /vendor/gopkg.in/olivere/elastic.v5/update.go | |
parent | e2f4492eadb5d3c58606b1fdd5774b63a07c236a (diff) | |
download | chat-58839cefb50e56ae5b157b37e9814ae83ceee70b.tar.gz chat-58839cefb50e56ae5b157b37e9814ae83ceee70b.tar.bz2 chat-58839cefb50e56ae5b157b37e9814ae83ceee70b.zip |
Upgrading server dependancies (#6984)
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/update.go')
-rw-r--r-- | vendor/gopkg.in/olivere/elastic.v5/update.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/update.go b/vendor/gopkg.in/olivere/elastic.v5/update.go index 67dafc700..d3446ff7f 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/update.go +++ b/vendor/gopkg.in/olivere/elastic.v5/update.go @@ -25,6 +25,7 @@ type UpdateService struct { parent string script *Script fields []string + fsc *FetchSourceContext version *int64 versionType string retryOnConflict *int @@ -172,6 +173,23 @@ func (b *UpdateService) Pretty(pretty bool) *UpdateService { return b } +// FetchSource asks Elasticsearch to return the updated _source in the response. +func (s *UpdateService) FetchSource(fetchSource bool) *UpdateService { + if s.fsc == nil { + s.fsc = NewFetchSourceContext(fetchSource) + } else { + s.fsc.SetFetchSource(fetchSource) + } + return s +} + +// FetchSourceContext indicates that _source should be returned in the response, +// allowing wildcard patterns to be defined via FetchSourceContext. +func (s *UpdateService) FetchSourceContext(fetchSourceContext *FetchSourceContext) *UpdateService { + s.fsc = fetchSourceContext + return s +} + // url returns the URL part of the document request. func (b *UpdateService) url() (string, url.Values, error) { // Build url @@ -250,6 +268,13 @@ func (b *UpdateService) body() (interface{}, error) { if b.detectNoop != nil { source["detect_noop"] = *b.detectNoop } + if b.fsc != nil { + src, err := b.fsc.Source() + if err != nil { + return nil, err + } + source["_source"] = src + } return source, nil } |