summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-09-29 12:46:30 -0700
committerGitHub <noreply@github.com>2017-09-29 12:46:30 -0700
commitb84736e9b6401df0c6eeab9950bef09458a6aefd (patch)
treed9175208de3236db75a33879750a57b3000ba096 /vendor/gopkg.in
parent8b9dbb86133ff0fd6002a391268383d1593918ca (diff)
downloadchat-b84736e9b6401df0c6eeab9950bef09458a6aefd.tar.gz
chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.tar.bz2
chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.zip
Updating server dependancies. (#7538)
Diffstat (limited to 'vendor/gopkg.in')
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/.gitignore1
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/.travis.yml10
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS4
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/README.md96
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/backoff_test.go6
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/client.go4
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/docker-compose.yml23
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/etc/ingest-geoip/.gitkeep0
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_fsq.go5
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match.go71
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all.go14
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all_test.go17
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_none.go39
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_none_test.go44
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase.go79
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_prefix.go89
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_prefix_test.go27
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_test.go29
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_queries_match_test.go34
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_source.go1
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_source_test.go4
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/update.go2
22 files changed, 403 insertions, 196 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/.gitignore b/vendor/gopkg.in/olivere/elastic.v5/.gitignore
index 89340bbe7..47140b99b 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/.gitignore
+++ b/vendor/gopkg.in/olivere/elastic.v5/.gitignore
@@ -21,6 +21,7 @@ _testmain.go
*.exe
+/.vscode/
/generator
/cluster-test/cluster-test
/cluster-test/*.log
diff --git a/vendor/gopkg.in/olivere/elastic.v5/.travis.yml b/vendor/gopkg.in/olivere/elastic.v5/.travis.yml
index e1466aa79..703fa01be 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/.travis.yml
+++ b/vendor/gopkg.in/olivere/elastic.v5/.travis.yml
@@ -2,15 +2,15 @@ sudo: required
language: go
script: go test -race -v . ./config
go:
- - 1.7
- - 1.8
- - tip
+ - 1.8.x
+ - 1.9.x
+ # - tip
matrix:
allow_failures:
- go: tip
services:
- docker
-before_script:
+before_install:
- sudo sysctl -w vm.max_map_count=262144
- - docker run --rm --privileged=true -p 9200:9200 -p 9300:9300 -e "bootstrap.memory_lock=true" -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:5.5.0 elasticsearch -Expack.security.enabled=false -Escript.inline=true -Escript.stored=true -Escript.file=true -Enetwork.host=_local_,_site_ -Enetwork.publish_host=_local_ >& /dev/null &
+ - docker run --rm --privileged=true -p 9200:9200 -p 9300:9300 -e "bootstrap.memory_lock=true" -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:5.6.1 elasticsearch -Expack.security.enabled=false -Escript.inline=true -Escript.stored=true -Escript.file=true -Enetwork.host=_local_,_site_ -Enetwork.publish_host=_local_ >& /dev/null &
- sleep 30
diff --git a/vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS b/vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS
index 0098a0d2d..572caf62d 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS
+++ b/vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS
@@ -29,6 +29,7 @@ Bruce Zhou [@brucez-isell](https://github.com/brucez-isell)
cforbes [@cforbes](https://github.com/cforbes)
Chris M [@tebriel](https://github.com/tebriel)
Chris Rice [@donutmonger](https://github.com/donutmonger)
+Claudiu Olteanu [@claudiuolteanu](https://github.com/claudiuolteanu)
Christophe Courtaut [@kri5](https://github.com/kri5)
Connor Peet [@connor4312](https://github.com/connor4312)
Conrad Pankoff [@deoxxa](https://github.com/deoxxa)
@@ -40,14 +41,17 @@ Dwayne Schultz [@myshkin5](https://github.com/myshkin5)
Ellison Leão [@ellisonleao](https://github.com/ellisonleao)
Erwin [@eticzon](https://github.com/eticzon)
Eugene Egorov [@EugeneEgorov](https://github.com/EugeneEgorov)
+Evan Shaw [@edsrzf](https://github.com/edsrzf)
Fanfan [@wenpos](https://github.com/wenpos)
Faolan C-P [@fcheslack](https://github.com/fcheslack)
Filip Tepper [@filiptepper](https://github.com/filiptepper)
+Gaylord Aulke [@blafasel42](https://github.com/blafasel42)
Gerhard Häring [@ghaering](https://github.com/ghaering)
Guilherme Silveira [@guilherme-santos](https://github.com/guilherme-santos)
Guillaume J. Charmes [@creack](https://github.com/creack)
Guiseppe [@gm42](https://github.com/gm42)
Han Yu [@MoonighT](https://github.com/MoonighT)
+Harmen [@alicebob](https://github.com/alicebob)
Harrison Wright [@wright8191](https://github.com/wright8191)
Henry Clifford [@hcliff](https://github.com/hcliff)
Igor Dubinskiy [@idubinskiy](https://github.com/idubinskiy)
diff --git a/vendor/gopkg.in/olivere/elastic.v5/README.md b/vendor/gopkg.in/olivere/elastic.v5/README.md
index ececd2769..45b84dab8 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/README.md
+++ b/vendor/gopkg.in/olivere/elastic.v5/README.md
@@ -107,101 +107,9 @@ The client connects to Elasticsearch on `http://127.0.0.1:9200` by default.
You typically create one client for your app. Here's a complete example of
creating a client, creating an index, adding a document, executing a search etc.
-```go
-// Create a context
-ctx := context.Background()
-
-// Create a client
-client, err := elastic.NewClient()
-if err != nil {
- // Handle error
- panic(err)
-}
-
-// Create an index
-_, err = client.CreateIndex("twitter").Do(ctx)
-if err != nil {
- // Handle error
- panic(err)
-}
-
-// Add a document to the index
-tweet := Tweet{User: "olivere", Message: "Take Five"}
-_, err = client.Index().
- Index("twitter").
- Type("tweet").
- Id("1").
- BodyJson(tweet).
- Refresh("true").
- Do(ctx)
-if err != nil {
- // Handle error
- panic(err)
-}
-
-// Search with a term query
-termQuery := elastic.NewTermQuery("user", "olivere")
-searchResult, err := client.Search().
- Index("twitter"). // search in index "twitter"
- Query(termQuery). // specify the query
- Sort("user", true). // sort by "user" field, ascending
- From(0).Size(10). // take documents 0-9
- Pretty(true). // pretty print request and response JSON
- Do(ctx) // execute
-if err != nil {
- // Handle error
- panic(err)
-}
-
-// searchResult is of type SearchResult and returns hits, suggestions,
-// and all kinds of other information from Elasticsearch.
-fmt.Printf("Query took %d milliseconds\n", searchResult.TookInMillis)
-
-// Each is a convenience function that iterates over hits in a search result.
-// It makes sure you don't need to check for nil values in the response.
-// However, it ignores errors in serialization. If you want full control
-// over iterating the hits, see below.
-var ttyp Tweet
-for _, item := range searchResult.Each(reflect.TypeOf(ttyp)) {
- if t, ok := item.(Tweet); ok {
- fmt.Printf("Tweet by %s: %s\n", t.User, t.Message)
- }
-}
-// TotalHits is another convenience function that works even when something goes wrong.
-fmt.Printf("Found a total of %d tweets\n", searchResult.TotalHits())
-
-// Here's how you iterate through results with full control over each step.
-if searchResult.Hits.TotalHits > 0 {
- fmt.Printf("Found a total of %d tweets\n", searchResult.Hits.TotalHits)
-
- // Iterate through results
- for _, hit := range searchResult.Hits.Hits {
- // hit.Index contains the name of the index
-
- // Deserialize hit.Source into a Tweet (could also be just a map[string]interface{}).
- var t Tweet
- err := json.Unmarshal(*hit.Source, &t)
- if err != nil {
- // Deserialization failed
- }
-
- // Work with tweet
- fmt.Printf("Tweet by %s: %s\n", t.User, t.Message)
- }
-} else {
- // No hits
- fmt.Print("Found no tweets\n")
-}
-
-// Delete the index again
-_, err = client.DeleteIndex("twitter").Do(ctx)
-if err != nil {
- // Handle error
- panic(err)
-}
-```
+An example is available [here](https://olivere.github.io/elastic/)
-Here's a [link to a complete working example](https://gist.github.com/olivere/114347ff9d9cfdca7bdc0ecea8b82263).
+Here's a [link to a complete working example for v3](https://gist.github.com/olivere/114347ff9d9cfdca7bdc0ecea8b82263).
See the [wiki](https://github.com/olivere/elastic/wiki) for more details.
diff --git a/vendor/gopkg.in/olivere/elastic.v5/backoff_test.go b/vendor/gopkg.in/olivere/elastic.v5/backoff_test.go
index aba7dcf76..eae168a12 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/backoff_test.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/backoff_test.go
@@ -130,13 +130,11 @@ func TestExponentialBackoff(t *testing.T) {
t.Errorf("expected [%v..%v], got %v", 8, 256, got)
}
- got, ok = b.Next(5)
- if ok {
+ if _, ok := b.Next(5); ok {
t.Fatalf("expected %v, got %v", false, ok)
}
- got, ok = b.Next(6)
- if ok {
+ if _, ok = b.Next(6); ok {
t.Fatalf("expected %v, got %v", false, ok)
}
}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/client.go b/vendor/gopkg.in/olivere/elastic.v5/client.go
index e517a7fa8..13b45d831 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/client.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/client.go
@@ -26,7 +26,7 @@ import (
const (
// Version is the current version of Elastic.
- Version = "5.0.45"
+ Version = "5.0.48"
// DefaultURL is the default endpoint of Elasticsearch on the local machine.
// It is used e.g. when initializing a new Client without a specific URL.
@@ -1059,7 +1059,6 @@ func (c *Client) healthcheck(timeout time.Duration, force bool) {
case <-ctx.Done(): // timeout
c.errorf("elastic: %s is dead", conn.URL())
conn.MarkAsDead()
- break
case err := <-errc:
if err != nil {
c.errorf("elastic: %s is dead", conn.URL())
@@ -1072,7 +1071,6 @@ func (c *Client) healthcheck(timeout time.Duration, force bool) {
conn.MarkAsDead()
c.errorf("elastic: %s is dead [status=%d]", conn.URL(), status)
}
- break
}
}
}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/docker-compose.yml b/vendor/gopkg.in/olivere/elastic.v5/docker-compose.yml
new file mode 100644
index 000000000..046096db2
--- /dev/null
+++ b/vendor/gopkg.in/olivere/elastic.v5/docker-compose.yml
@@ -0,0 +1,23 @@
+version: '3'
+
+services:
+ elasticsearch:
+ image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
+ # container_name: elasticsearch
+ hostname: elasticsearch
+ environment:
+ - bootstrap.memory_lock=true
+ - xpack.security.enabled=false
+ - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
+ ulimits:
+ nproc: 65536
+ nofile:
+ soft: 65536
+ hard: 65536
+ memlock:
+ soft: -1
+ hard: -1
+ volumes:
+ - ./etc:/usr/share/elasticsearch/config
+ ports:
+ - 9200:9200
diff --git a/vendor/gopkg.in/olivere/elastic.v5/etc/ingest-geoip/.gitkeep b/vendor/gopkg.in/olivere/elastic.v5/etc/ingest-geoip/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/vendor/gopkg.in/olivere/elastic.v5/etc/ingest-geoip/.gitkeep
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_fsq.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_fsq.go
index 46f3e78ca..ec34302f8 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_fsq.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_fsq.go
@@ -35,13 +35,11 @@ func NewFunctionScoreQuery() *FunctionScoreQuery {
// Query sets the query for the function score query.
func (q *FunctionScoreQuery) Query(query Query) *FunctionScoreQuery {
q.query = query
- q.filter = nil
return q
}
// Filter sets the filter for the function score query.
func (q *FunctionScoreQuery) Filter(filter Query) *FunctionScoreQuery {
- q.query = nil
q.filter = filter
return q
}
@@ -107,7 +105,8 @@ func (q *FunctionScoreQuery) Source() (interface{}, error) {
return nil, err
}
query["query"] = src
- } else if q.filter != nil {
+ }
+ if q.filter != nil {
src, err := q.filter.Source()
if err != nil {
return nil, err
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match.go
index 0c44c5d57..1f2f16f69 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match.go
@@ -16,16 +16,13 @@ package elastic
type MatchQuery struct {
name string
text interface{}
- typ string // boolean, phrase, phrase_prefix
operator string // or / and
analyzer string
boost *float64
- slop *int
fuzziness string
prefixLength *int
maxExpansions *int
minimumShouldMatch string
- rewrite string
fuzzyRewrite string
lenient *bool
fuzzyTranspositions *bool
@@ -39,22 +36,6 @@ func NewMatchQuery(name string, text interface{}) *MatchQuery {
return &MatchQuery{name: name, text: text}
}
-// NewMatchPhraseQuery creates and initializes a new MatchQuery of type phrase.
-func NewMatchPhraseQuery(name string, text interface{}) *MatchQuery {
- return &MatchQuery{name: name, text: text, typ: "phrase"}
-}
-
-// NewMatchPhrasePrefixQuery creates and initializes a new MatchQuery of type phrase_prefix.
-func NewMatchPhrasePrefixQuery(name string, text interface{}) *MatchQuery {
- return &MatchQuery{name: name, text: text, typ: "phrase_prefix"}
-}
-
-// Type can be "boolean", "phrase", or "phrase_prefix". Defaults to "boolean".
-func (q *MatchQuery) Type(typ string) *MatchQuery {
- q.typ = typ
- return q
-}
-
// Operator sets the operator to use when using a boolean query.
// Can be "AND" or "OR" (default).
func (q *MatchQuery) Operator(operator string) *MatchQuery {
@@ -69,18 +50,6 @@ func (q *MatchQuery) Analyzer(analyzer string) *MatchQuery {
return q
}
-// Boost sets the boost to apply to this query.
-func (q *MatchQuery) Boost(boost float64) *MatchQuery {
- q.boost = &boost
- return q
-}
-
-// Slop sets the phrase slop if evaluated to a phrase query type.
-func (q *MatchQuery) Slop(slop int) *MatchQuery {
- q.slop = &slop
- return q
-}
-
// Fuzziness sets the fuzziness when evaluated to a fuzzy query type.
// Defaults to "AUTO".
func (q *MatchQuery) Fuzziness(fuzziness string) *MatchQuery {
@@ -88,6 +57,8 @@ func (q *MatchQuery) Fuzziness(fuzziness string) *MatchQuery {
return q
}
+// PrefixLength sets the length of a length of common (non-fuzzy)
+// prefix for fuzzy match queries. It must be non-negative.
func (q *MatchQuery) PrefixLength(prefixLength int) *MatchQuery {
q.prefixLength = &prefixLength
return q
@@ -109,21 +80,28 @@ func (q *MatchQuery) CutoffFrequency(cutoff float64) *MatchQuery {
return q
}
+// MinimumShouldMatch sets the optional minimumShouldMatch value to
+// apply to the query.
func (q *MatchQuery) MinimumShouldMatch(minimumShouldMatch string) *MatchQuery {
q.minimumShouldMatch = minimumShouldMatch
return q
}
-func (q *MatchQuery) Rewrite(rewrite string) *MatchQuery {
- q.rewrite = rewrite
- return q
-}
-
+// FuzzyRewrite sets the fuzzy_rewrite parameter controlling how the
+// fuzzy query will get rewritten.
func (q *MatchQuery) FuzzyRewrite(fuzzyRewrite string) *MatchQuery {
q.fuzzyRewrite = fuzzyRewrite
return q
}
+// FuzzyTranspositions sets whether transpositions are supported in
+// fuzzy queries.
+//
+// The default metric used by fuzzy queries to determine a match is
+// the Damerau-Levenshtein distance formula which supports transpositions.
+// Setting transposition to false will
+// * switch to classic Levenshtein distance.
+// * If not set, Damerau-Levenshtein distance metric will be used.
func (q *MatchQuery) FuzzyTranspositions(fuzzyTranspositions bool) *MatchQuery {
q.fuzzyTranspositions = &fuzzyTranspositions
return q
@@ -141,6 +119,12 @@ func (q *MatchQuery) ZeroTermsQuery(zeroTermsQuery string) *MatchQuery {
return q
}
+// Boost sets the boost to apply to this query.
+func (q *MatchQuery) Boost(boost float64) *MatchQuery {
+ q.boost = &boost
+ return q
+}
+
// QueryName sets the query name for the filter that can be used when
// searching for matched filters per hit.
func (q *MatchQuery) QueryName(queryName string) *MatchQuery {
@@ -161,21 +145,12 @@ func (q *MatchQuery) Source() (interface{}, error) {
query["query"] = q.text
- if q.typ != "" {
- query["type"] = q.typ
- }
if q.operator != "" {
query["operator"] = q.operator
}
if q.analyzer != "" {
query["analyzer"] = q.analyzer
}
- if q.boost != nil {
- query["boost"] = *q.boost
- }
- if q.slop != nil {
- query["slop"] = *q.slop
- }
if q.fuzziness != "" {
query["fuzziness"] = q.fuzziness
}
@@ -188,9 +163,6 @@ func (q *MatchQuery) Source() (interface{}, error) {
if q.minimumShouldMatch != "" {
query["minimum_should_match"] = q.minimumShouldMatch
}
- if q.rewrite != "" {
- query["rewrite"] = q.rewrite
- }
if q.fuzzyRewrite != "" {
query["fuzzy_rewrite"] = q.fuzzyRewrite
}
@@ -206,6 +178,9 @@ func (q *MatchQuery) Source() (interface{}, error) {
if q.cutoffFrequency != nil {
query["cutoff_frequency"] = q.cutoffFrequency
}
+ if q.boost != nil {
+ query["boost"] = *q.boost
+ }
if q.queryName != "" {
query["_name"] = q.queryName
}
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
}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all_test.go
index 11cf5c5f7..5d8671025 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all_test.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_all_test.go
@@ -42,3 +42,20 @@ func TestMatchAllQueryWithBoost(t *testing.T) {
t.Errorf("expected\n%s\n,got:\n%s", expected, got)
}
}
+
+func TestMatchAllQueryWithQueryName(t *testing.T) {
+ q := NewMatchAllQuery().QueryName("qname")
+ src, err := q.Source()
+ if err != nil {
+ t.Fatal(err)
+ }
+ data, err := json.Marshal(src)
+ if err != nil {
+ t.Fatalf("marshaling to JSON failed: %v", err)
+ }
+ got := string(data)
+ expected := `{"match_all":{"_name":"qname"}}`
+ if got != expected {
+ t.Errorf("expected\n%s\n,got:\n%s", expected, got)
+ }
+}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_none.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_none.go
new file mode 100644
index 000000000..06d036e71
--- /dev/null
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_none.go
@@ -0,0 +1,39 @@
+// Copyright 2012-present Oliver Eilhard. All rights reserved.
+// Use of this source code is governed by a MIT-license.
+// See http://olivere.mit-license.org/license.txt for details.
+
+package elastic
+
+// MatchNoneQuery returns no documents. It is the inverse of
+// MatchAllQuery.
+//
+// For more details, see
+// https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-match-all-query.html
+type MatchNoneQuery struct {
+ queryName string
+}
+
+// NewMatchNoneQuery creates and initializes a new match none query.
+func NewMatchNoneQuery() *MatchNoneQuery {
+ return &MatchNoneQuery{}
+}
+
+// QueryName sets the query name.
+func (q *MatchNoneQuery) QueryName(name string) *MatchNoneQuery {
+ q.queryName = name
+ return q
+}
+
+// Source returns JSON for the match none query.
+func (q MatchNoneQuery) Source() (interface{}, error) {
+ // {
+ // "match_none" : { ... }
+ // }
+ source := make(map[string]interface{})
+ params := make(map[string]interface{})
+ source["match_none"] = params
+ if q.queryName != "" {
+ params["_name"] = q.queryName
+ }
+ return source, nil
+}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_none_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_none_test.go
new file mode 100644
index 000000000..6463452da
--- /dev/null
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_none_test.go
@@ -0,0 +1,44 @@
+// Copyright 2012-present Oliver Eilhard. All rights reserved.
+// Use of this source code is governed by a MIT-license.
+// See http://olivere.mit-license.org/license.txt for details.
+
+package elastic
+
+import (
+ "encoding/json"
+ "testing"
+)
+
+func TestMatchNoneQuery(t *testing.T) {
+ q := NewMatchNoneQuery()
+ src, err := q.Source()
+ if err != nil {
+ t.Fatal(err)
+ }
+ data, err := json.Marshal(src)
+ if err != nil {
+ t.Fatalf("marshaling to JSON failed: %v", err)
+ }
+ got := string(data)
+ expected := `{"match_none":{}}`
+ if got != expected {
+ t.Errorf("expected\n%s\n,got:\n%s", expected, got)
+ }
+}
+
+func TestMatchNoneQueryWithQueryName(t *testing.T) {
+ q := NewMatchNoneQuery().QueryName("qname")
+ src, err := q.Source()
+ if err != nil {
+ t.Fatal(err)
+ }
+ data, err := json.Marshal(src)
+ if err != nil {
+ t.Fatalf("marshaling to JSON failed: %v", err)
+ }
+ got := string(data)
+ expected := `{"match_none":{"_name":"qname"}}`
+ if got != expected {
+ t.Errorf("expected\n%s\n,got:\n%s", expected, got)
+ }
+}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase.go
new file mode 100644
index 000000000..fdded2e76
--- /dev/null
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase.go
@@ -0,0 +1,79 @@
+// Copyright 2012-present Oliver Eilhard. All rights reserved.
+// Use of this source code is governed by a MIT-license.
+// See http://olivere.mit-license.org/license.txt for details.
+
+package elastic
+
+// MatchPhraseQuery analyzes the text and creates a phrase query out of
+// the analyzed text.
+//
+// For more details, see
+// https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-match-query-phrase.html
+type MatchPhraseQuery struct {
+ name string
+ value interface{}
+ analyzer string
+ slop *int
+ boost *float64
+ queryName string
+}
+
+// NewMatchPhraseQuery creates and initializes a new MatchPhraseQuery.
+func NewMatchPhraseQuery(name string, value interface{}) *MatchPhraseQuery {
+ return &MatchPhraseQuery{name: name, value: value}
+}
+
+// Analyzer explicitly sets the analyzer to use. It defaults to use explicit
+// mapping config for the field, or, if not set, the default search analyzer.
+func (q *MatchPhraseQuery) Analyzer(analyzer string) *MatchPhraseQuery {
+ q.analyzer = analyzer
+ return q
+}
+
+// Slop sets the phrase slop if evaluated to a phrase query type.
+func (q *MatchPhraseQuery) Slop(slop int) *MatchPhraseQuery {
+ q.slop = &slop
+ return q
+}
+
+// Boost sets the boost to apply to this query.
+func (q *MatchPhraseQuery) Boost(boost float64) *MatchPhraseQuery {
+ q.boost = &boost
+ return q
+}
+
+// QueryName sets the query name for the filter that can be used when
+// searching for matched filters per hit.
+func (q *MatchPhraseQuery) QueryName(queryName string) *MatchPhraseQuery {
+ q.queryName = queryName
+ return q
+}
+
+// Source returns JSON for the function score query.
+func (q *MatchPhraseQuery) Source() (interface{}, error) {
+ // {"match_phrase":{"name":{"query":"value","analyzer":"my_analyzer"}}}
+ source := make(map[string]interface{})
+
+ match := make(map[string]interface{})
+ source["match_phrase"] = match
+
+ query := make(map[string]interface{})
+ match[q.name] = query
+
+ query["query"] = q.value
+
+ if q.analyzer != "" {
+ query["analyzer"] = q.analyzer
+ }
+ if q.slop != nil {
+ query["slop"] = *q.slop
+ }
+ if q.boost != nil {
+ query["boost"] = *q.boost
+ }
+ if q.queryName != "" {
+ query["_name"] = q.queryName
+ }
+
+ return source, nil
+}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_prefix.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_prefix.go
new file mode 100644
index 000000000..1eeba8af5
--- /dev/null
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_prefix.go
@@ -0,0 +1,89 @@
+// Copyright 2012-present Oliver Eilhard. All rights reserved.
+// Use of this source code is governed by a MIT-license.
+// See http://olivere.mit-license.org/license.txt for details.
+
+package elastic
+
+// MatchPhrasePrefixQuery is the same as match_phrase, except that it allows for
+// prefix matches on the last term in the text.
+//
+// For more details, see
+// https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-match-query-phrase-prefix.html
+type MatchPhrasePrefixQuery struct {
+ name string
+ value interface{}
+ analyzer string
+ slop *int
+ maxExpansions *int
+ boost *float64
+ queryName string
+}
+
+// NewMatchPhrasePrefixQuery creates and initializes a new MatchPhrasePrefixQuery.
+func NewMatchPhrasePrefixQuery(name string, value interface{}) *MatchPhrasePrefixQuery {
+ return &MatchPhrasePrefixQuery{name: name, value: value}
+}
+
+// Analyzer explicitly sets the analyzer to use. It defaults to use explicit
+// mapping config for the field, or, if not set, the default search analyzer.
+func (q *MatchPhrasePrefixQuery) Analyzer(analyzer string) *MatchPhrasePrefixQuery {
+ q.analyzer = analyzer
+ return q
+}
+
+// Slop sets the phrase slop if evaluated to a phrase query type.
+func (q *MatchPhrasePrefixQuery) Slop(slop int) *MatchPhrasePrefixQuery {
+ q.slop = &slop
+ return q
+}
+
+// MaxExpansions sets the number of term expansions to use.
+func (q *MatchPhrasePrefixQuery) MaxExpansions(n int) *MatchPhrasePrefixQuery {
+ q.maxExpansions = &n
+ return q
+}
+
+// Boost sets the boost to apply to this query.
+func (q *MatchPhrasePrefixQuery) Boost(boost float64) *MatchPhrasePrefixQuery {
+ q.boost = &boost
+ return q
+}
+
+// QueryName sets the query name for the filter that can be used when
+// searching for matched filters per hit.
+func (q *MatchPhrasePrefixQuery) QueryName(queryName string) *MatchPhrasePrefixQuery {
+ q.queryName = queryName
+ return q
+}
+
+// Source returns JSON for the function score query.
+func (q *MatchPhrasePrefixQuery) Source() (interface{}, error) {
+ // {"match_phrase_prefix":{"name":{"query":"value","max_expansions":10}}}
+ source := make(map[string]interface{})
+
+ match := make(map[string]interface{})
+ source["match_phrase_prefix"] = match
+
+ query := make(map[string]interface{})
+ match[q.name] = query
+
+ query["query"] = q.value
+
+ if q.analyzer != "" {
+ query["analyzer"] = q.analyzer
+ }
+ if q.slop != nil {
+ query["slop"] = *q.slop
+ }
+ if q.maxExpansions != nil {
+ query["max_expansions"] = *q.maxExpansions
+ }
+ if q.boost != nil {
+ query["boost"] = *q.boost
+ }
+ if q.queryName != "" {
+ query["_name"] = q.queryName
+ }
+
+ return source, nil
+}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_prefix_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_prefix_test.go
new file mode 100644
index 000000000..82a02f17d
--- /dev/null
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_prefix_test.go
@@ -0,0 +1,27 @@
+// Copyright 2012-present Oliver Eilhard. All rights reserved.
+// Use of this source code is governed by a MIT-license.
+// See http://olivere.mit-license.org/license.txt for details.
+
+package elastic
+
+import (
+ "encoding/json"
+ "testing"
+)
+
+func TestMatchPhrasePrefixQuery(t *testing.T) {
+ q := NewMatchPhrasePrefixQuery("message", "this is a test").Boost(0.3).MaxExpansions(5)
+ src, err := q.Source()
+ if err != nil {
+ t.Fatal(err)
+ }
+ data, err := json.Marshal(src)
+ if err != nil {
+ t.Fatalf("marshaling to JSON failed: %v", err)
+ }
+ got := string(data)
+ expected := `{"match_phrase_prefix":{"message":{"boost":0.3,"max_expansions":5,"query":"this is a test"}}}`
+ if got != expected {
+ t.Errorf("expected\n%s\n,got:\n%s", expected, got)
+ }
+}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_test.go
new file mode 100644
index 000000000..85e60d8b5
--- /dev/null
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_phrase_test.go
@@ -0,0 +1,29 @@
+// Copyright 2012-present Oliver Eilhard. All rights reserved.
+// Use of this source code is governed by a MIT-license.
+// See http://olivere.mit-license.org/license.txt for details.
+
+package elastic
+
+import (
+ "encoding/json"
+ "testing"
+)
+
+func TestMatchPhraseQuery(t *testing.T) {
+ q := NewMatchPhraseQuery("message", "this is a test").
+ Analyzer("my_analyzer").
+ Boost(0.7)
+ src, err := q.Source()
+ if err != nil {
+ t.Fatal(err)
+ }
+ data, err := json.Marshal(src)
+ if err != nil {
+ t.Fatalf("marshaling to JSON failed: %v", err)
+ }
+ got := string(data)
+ expected := `{"match_phrase":{"message":{"analyzer":"my_analyzer","boost":0.7,"query":"this is a test"}}}`
+ if got != expected {
+ t.Errorf("expected\n%s\n,got:\n%s", expected, got)
+ }
+}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_test.go
index af3fe688a..dd750cf93 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_test.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_match_test.go
@@ -26,40 +26,6 @@ func TestMatchQuery(t *testing.T) {
}
}
-func TestMatchPhraseQuery(t *testing.T) {
- q := NewMatchPhraseQuery("message", "this is a test")
- src, err := q.Source()
- if err != nil {
- t.Fatal(err)
- }
- data, err := json.Marshal(src)
- if err != nil {
- t.Fatalf("marshaling to JSON failed: %v", err)
- }
- got := string(data)
- expected := `{"match":{"message":{"query":"this is a test","type":"phrase"}}}`
- if got != expected {
- t.Errorf("expected\n%s\n,got:\n%s", expected, got)
- }
-}
-
-func TestMatchPhrasePrefixQuery(t *testing.T) {
- q := NewMatchPhrasePrefixQuery("message", "this is a test")
- src, err := q.Source()
- if err != nil {
- t.Fatal(err)
- }
- data, err := json.Marshal(src)
- if err != nil {
- t.Fatalf("marshaling to JSON failed: %v", err)
- }
- got := string(data)
- expected := `{"match":{"message":{"query":"this is a test","type":"phrase_prefix"}}}`
- if got != expected {
- t.Errorf("expected\n%s\n,got:\n%s", expected, got)
- }
-}
-
func TestMatchQueryWithOptions(t *testing.T) {
q := NewMatchQuery("message", "this is a test").Analyzer("whitespace").Operator("or").Boost(2.5)
src, err := q.Source()
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_source.go b/vendor/gopkg.in/olivere/elastic.v5/search_source.go
index 9bc7a4a80..6a8efd229 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search_source.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_source.go
@@ -536,6 +536,7 @@ func (s *SearchSource) Source() (interface{}, error) {
}
} else {
// TODO the Java client throws here, because either path or typ must be specified
+ _ = m
}
}
source["inner_hits"] = m
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_source_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_source_test.go
index 1e4c814f4..49e52f660 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search_source_test.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_source_test.go
@@ -178,7 +178,7 @@ func TestSearchSourceHighlight(t *testing.T) {
func TestSearchSourceRescoring(t *testing.T) {
matchAllQ := NewMatchAllQuery()
- rescorerQuery := NewMatchQuery("field1", "the quick brown fox").Type("phrase").Slop(2)
+ rescorerQuery := NewMatchPhraseQuery("field1", "the quick brown fox").Slop(2)
rescorer := NewQueryRescorer(rescorerQuery)
rescorer = rescorer.QueryWeight(0.7)
rescorer = rescorer.RescoreQueryWeight(1.2)
@@ -193,7 +193,7 @@ func TestSearchSourceRescoring(t *testing.T) {
t.Fatalf("marshaling to JSON failed: %v", err)
}
got := string(data)
- expected := `{"query":{"match_all":{}},"rescore":{"query":{"query_weight":0.7,"rescore_query":{"match":{"field1":{"query":"the quick brown fox","slop":2,"type":"phrase"}}},"rescore_query_weight":1.2},"window_size":50}}`
+ expected := `{"query":{"match_all":{}},"rescore":{"query":{"query_weight":0.7,"rescore_query":{"match_phrase":{"field1":{"query":"the quick brown fox","slop":2}}},"rescore_query_weight":1.2},"window_size":50}}`
if got != expected {
t.Errorf("expected\n%s\n,got:\n%s", expected, got)
}
diff --git a/vendor/gopkg.in/olivere/elastic.v5/update.go b/vendor/gopkg.in/olivere/elastic.v5/update.go
index d3446ff7f..1718bc585 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/update.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/update.go
@@ -313,7 +313,7 @@ type UpdateResponse struct {
Id string `json:"_id"`
Version int `json:"_version"`
Shards *shardsInfo `json:"_shards"`
- Result bool `json:"string,omitempty"`
+ Result string `json:"result,omitempty"`
ForcedRefresh bool `json:"forced_refresh,omitempty"`
GetResult *GetResult `json:"get,omitempty"`
}