diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-05-17 16:51:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-17 16:51:25 -0400 |
commit | d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26 (patch) | |
tree | dbde13123c6add150448f7b75753ac022d862475 /vendor/gopkg.in/olivere | |
parent | cd23b8139a9463b67e3096744321f6f4eb0ca40a (diff) | |
download | chat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.tar.gz chat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.tar.bz2 chat-d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26.zip |
Upgrading server dependancies (#6431)
Diffstat (limited to 'vendor/gopkg.in/olivere')
12 files changed, 121 insertions, 28 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/.travis.yml b/vendor/gopkg.in/olivere/elastic.v5/.travis.yml index 31fe3bd12..c2aa4b378 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/.travis.yml +++ b/vendor/gopkg.in/olivere/elastic.v5/.travis.yml @@ -13,5 +13,5 @@ before_script: - mkdir -p /tmp/elasticsearch/config - cp -r config/* /tmp/elasticsearch/config/ - sudo sysctl -w vm.max_map_count=262144 - - docker run --rm --privileged=true -p 9200:9200 -p 9300:9300 -v "/tmp/elasticsearch/config:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:5.3.0 elasticsearch >& /dev/null & + - docker run --rm --privileged=true -p 9200:9200 -p 9300:9300 -v "/tmp/elasticsearch/config:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:5.4.0 elasticsearch >& /dev/null & - sleep 15 diff --git a/vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS b/vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS index 39a71f90b..7e63e9eac 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS +++ b/vendor/gopkg.in/olivere/elastic.v5/CONTRIBUTORS @@ -10,18 +10,21 @@ Adam Alix [@adamalix](https://github.com/adamalix) Adam Weiner [@adamweiner](https://github.com/adamweiner) Adrian Lungu [@AdrianLungu](https://github.com/AdrianLungu) +alehano [@alehano](https://github.com/alehano) Alex [@akotlar](https://github.com/akotlar) Alexandre Olivier [@aliphen](https://github.com/aliphen) Alexey Sharov [@nizsheanez](https://github.com/nizsheanez) AndreKR [@AndreKR](https://github.com/AndreKR) Andrew Dunham [@andrew-d](https://github.com/andrew-d) Andrew Gaul [@andrewgaul](https://github.com/andrewgaul) +Arquivei [@arquivei](https://github.com/arquivei) Benjamin Fernandes [@LotharSee](https://github.com/LotharSee) Benjamin Zarzycki [@kf6nux](https://github.com/kf6nux) Braden Bassingthwaite [@bbassingthwaite-va](https://github.com/bbassingthwaite-va) Brady Love [@bradylove](https://github.com/bradylove) Bryan Conklin [@bmconklin](https://github.com/bmconklin) Bruce Zhou [@brucez-isell](https://github.com/brucez-isell) +cforbes [@cforbes](https://github.com/cforbes) Chris M [@tebriel](https://github.com/tebriel) Christophe Courtaut [@kri5](https://github.com/kri5) Conrad Pankoff [@deoxxa](https://github.com/deoxxa) diff --git a/vendor/gopkg.in/olivere/elastic.v5/bulk.go b/vendor/gopkg.in/olivere/elastic.v5/bulk.go index efb85aeed..eac240ddb 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/bulk.go +++ b/vendor/gopkg.in/olivere/elastic.v5/bulk.go @@ -300,13 +300,15 @@ type BulkResponse struct { // BulkResponseItem is the result of a single bulk request. type BulkResponseItem struct { - Index string `json:"_index,omitempty"` - Type string `json:"_type,omitempty"` - Id string `json:"_id,omitempty"` - Version int64 `json:"_version,omitempty"` - Status int `json:"status,omitempty"` - Found bool `json:"found,omitempty"` - Error *ErrorDetails `json:"error,omitempty"` + Index string `json:"_index,omitempty"` + Type string `json:"_type,omitempty"` + Id string `json:"_id,omitempty"` + Version int64 `json:"_version,omitempty"` + Status int `json:"status,omitempty"` + Result string `json:"result,omitempty"` + ForcedRefresh bool `json:"forced_refresh,omitempty"` + Found bool `json:"found,omitempty"` + Error *ErrorDetails `json:"error,omitempty"` } // Indexed returns all bulk request results of "index" actions. diff --git a/vendor/gopkg.in/olivere/elastic.v5/client.go b/vendor/gopkg.in/olivere/elastic.v5/client.go index 438de164d..df0d9a7dd 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/client.go +++ b/vendor/gopkg.in/olivere/elastic.v5/client.go @@ -8,7 +8,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "net/http" "net/http/httputil" @@ -17,11 +16,13 @@ import ( "strings" "sync" "time" + + "github.com/pkg/errors" ) const ( // Version is the current version of Elastic. - Version = "5.0.36" + Version = "5.0.38" // 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. @@ -811,7 +812,7 @@ func (c *Client) sniff(timeout time.Duration) error { c.connsMu.RUnlock() if len(urls) == 0 { - return ErrNoClient + return errors.Wrap(ErrNoClient, "no URLs found") } // Start sniffing on all found URLs @@ -830,7 +831,7 @@ func (c *Client) sniff(timeout time.Duration) error { } case <-time.After(timeout): // We get here if no cluster responds in time - return ErrNoClient + return errors.Wrap(ErrNoClient, "sniff timeout") } } } @@ -1063,7 +1064,7 @@ func (c *Client) startupHealthcheck(timeout time.Duration) error { break } } - return ErrNoClient + return errors.Wrap(ErrNoClient, "health check timeout") } // next returns the next available connection, or ErrNoClient. @@ -1102,7 +1103,7 @@ func (c *Client) next() (*conn, error) { } // We tried hard, but there is no node available - return nil, ErrNoClient + return nil, errors.Wrap(ErrNoClient, "no avaiable connection") } // mustActiveConn returns nil if there is an active connection, @@ -1116,7 +1117,7 @@ func (c *Client) mustActiveConn() error { return nil } } - return ErrNoClient + return errors.Wrap(ErrNoClient, "no active connection found") } // PerformRequest does a HTTP request to Elasticsearch. @@ -1157,7 +1158,7 @@ func (c *Client) PerformRequest(ctx context.Context, method, path string, params // Get a connection conn, err = c.next() - if err == ErrNoClient { + if errors.Cause(err) == ErrNoClient { n++ if !retried { // Force a healtcheck as all connections seem to be dead. @@ -1716,3 +1717,9 @@ func (c *Client) WaitForGreenStatus(timeout string) error { func (c *Client) WaitForYellowStatus(timeout string) error { return c.WaitForStatus("yellow", timeout) } + +// IsConnError unwraps the given error value and checks if it is equal to +// elastic.ErrNoClient. +func IsConnErr(err error) bool { + return errors.Cause(err) == ErrNoClient +} diff --git a/vendor/gopkg.in/olivere/elastic.v5/client_test.go b/vendor/gopkg.in/olivere/elastic.v5/client_test.go index f038b4855..46aa42619 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/client_test.go +++ b/vendor/gopkg.in/olivere/elastic.v5/client_test.go @@ -271,7 +271,7 @@ func TestClientHealthcheckStartupTimeout(t *testing.T) { start := time.Now() _, err := NewClient(SetURL("http://localhost:9299"), SetHealthcheckTimeoutStartup(5*time.Second)) duration := time.Now().Sub(start) - if err != ErrNoClient { + if !IsConnErr(err) { t.Fatal(err) } if duration < 5*time.Second { @@ -647,9 +647,9 @@ func TestClientSelectConnAllDead(t *testing.T) { client.conns[1].MarkAsDead() // If all connections are dead, next should make them alive again, but - // still return ErrNoClient when it first finds out. + // still return an error when it first finds out. c, err := client.next() - if err != ErrNoClient { + if !IsConnErr(err) { t.Fatal(err) } if c != nil { diff --git a/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go b/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go index 7f1489697..ffac0d0f2 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go +++ b/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go @@ -52,7 +52,7 @@ func TestMappingLifecycle(t *testing.T) { "tweetdoc":{ "properties":{ "field":{ - "type":"string" + "type":"keyword" } } } diff --git a/vendor/gopkg.in/olivere/elastic.v5/run-es-5.4.0.sh b/vendor/gopkg.in/olivere/elastic.v5/run-es-5.4.0.sh new file mode 100755 index 000000000..6d33c1f13 --- /dev/null +++ b/vendor/gopkg.in/olivere/elastic.v5/run-es-5.4.0.sh @@ -0,0 +1 @@ +docker run --rm --privileged=true -p 9200:9200 -p 9300:9300 -v "$PWD/config:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:5.4.0 elasticsearch diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_nested.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_nested.go index 11e3bb1c6..a95cc2b80 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_nested.go +++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_nested.go @@ -12,12 +12,13 @@ package elastic // For more details, see // https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-nested-query.html type NestedQuery struct { - query Query - path string - scoreMode string - boost *float64 - queryName string - innerHit *InnerHit + query Query + path string + scoreMode string + boost *float64 + queryName string + innerHit *InnerHit + ignoreUnmapped *bool } // NewNestedQuery creates and initializes a new NestedQuery. @@ -51,6 +52,13 @@ func (q *NestedQuery) InnerHit(innerHit *InnerHit) *NestedQuery { return q } +// IgnoreUnmapped sets the ignore_unmapped option for the filter that ignores +// unmapped nested fields +func (q *NestedQuery) IgnoreUnmapped(value bool) *NestedQuery { + q.ignoreUnmapped = &value + return q +} + // Source returns JSON for the query. func (q *NestedQuery) Source() (interface{}, error) { query := make(map[string]interface{}) @@ -74,6 +82,9 @@ func (q *NestedQuery) Source() (interface{}, error) { if q.queryName != "" { nq["_name"] = q.queryName } + if q.ignoreUnmapped != nil { + nq["ignore_unmapped"] = *q.ignoreUnmapped + } if q.innerHit != nil { src, err := q.innerHit.Source() if err != nil { diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_nested_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_nested_test.go index af9740553..c7a5322a6 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_nested_test.go +++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_nested_test.go @@ -50,3 +50,37 @@ func TestNestedQueryWithInnerHit(t *testing.T) { t.Errorf("expected\n%s\n,got:\n%s", expected, got) } } + +func TestNestedQueryWithIgnoreUnmapped(t *testing.T) { + var tests = []struct { + query *BoolQuery + expected string + }{ + { + NewBoolQuery().Must(NewNestedQuery("path", NewTermQuery("test", "test"))), + `{"bool":{"must":{"nested":{"path":"path","query":{"term":{"test":"test"}}}}}}`, + }, + { + NewBoolQuery().Must(NewNestedQuery("path", NewTermQuery("test", "test")).IgnoreUnmapped(true)), + `{"bool":{"must":{"nested":{"ignore_unmapped":true,"path":"path","query":{"term":{"test":"test"}}}}}}`, + }, + { + NewBoolQuery().Must(NewNestedQuery("path", NewTermQuery("test", "test")).IgnoreUnmapped(false)), + `{"bool":{"must":{"nested":{"ignore_unmapped":false,"path":"path","query":{"term":{"test":"test"}}}}}}`, + }, + } + for _, test := range tests { + src, err := test.query.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) + if got != test.expected { + t.Errorf("expected\n%s\n,got:\n%s", test.expected, got) + } + } +} diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix.go index dcf20ea70..0d5077553 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix.go +++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix.go @@ -50,7 +50,7 @@ func (q *PrefixQuery) Source() (interface{}, error) { query[q.name] = q.prefix } else { subQuery := make(map[string]interface{}) - subQuery["prefix"] = q.prefix + subQuery["value"] = q.prefix if q.boost != nil { subQuery["boost"] = *q.boost } diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix_example_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix_example_test.go new file mode 100644 index 000000000..1a421784e --- /dev/null +++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix_example_test.go @@ -0,0 +1,35 @@ +// 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_test + +import ( + "context" + + "gopkg.in/olivere/elastic.v5" +) + +func ExamplePrefixQuery() { + // Get a client to the local Elasticsearch instance. + client, err := elastic.NewClient() + if err != nil { + // Handle error + panic(err) + } + + // Define wildcard query + q := elastic.NewPrefixQuery("user", "oli") + q = q.QueryName("my_query_name") + + searchResult, err := client.Search(). + Index("twitter"). + Query(q). + Pretty(true). + Do(context.Background()) + if err != nil { + // Handle error + panic(err) + } + _ = searchResult +} diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix_test.go b/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix_test.go index dcd47e2a1..78d27b600 100644 --- a/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix_test.go +++ b/vendor/gopkg.in/olivere/elastic.v5/search_queries_prefix_test.go @@ -38,7 +38,7 @@ func TestPrefixQueryWithOptions(t *testing.T) { t.Fatalf("marshaling to JSON failed: %v", err) } got := string(data) - expected := `{"prefix":{"user":{"_name":"my_query_name","prefix":"ki"}}}` + expected := `{"prefix":{"user":{"_name":"my_query_name","value":"ki"}}}` if got != expected { t.Errorf("expected\n%s\n,got:\n%s", expected, got) } |