Skip to content

Commit a4c3e84

Browse files
committed
Release 7.0.7
1 parent 2046010 commit a4c3e84

6 files changed

+21
-96
lines changed

.edit.swp

-16 KB
Binary file not shown.

.golangci.yml

-78
This file was deleted.

client.go

+16-10
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626

2727
const (
2828
// Version is the current version of Elastic.
29-
Version = "7.0.6"
29+
Version = "7.0.7"
3030

3131
// DefaultURL is the default endpoint of Elasticsearch on the local machine.
3232
// It is used e.g. when initializing a new Client without a specific URL.
@@ -97,6 +97,9 @@ var (
9797

9898
// noRetries is a retrier that does not retry.
9999
noRetries = NewStopRetrier()
100+
101+
// noDeprecationLog is a no-op for logging deprecations.
102+
noDeprecationLog = func(*http.Request, *http.Response) {}
100103
)
101104

102105
// Doer is an interface to perform HTTP requests.
@@ -117,12 +120,13 @@ type Client struct {
117120
conns []*conn // all connections
118121
cindex int // index into conns
119122

120-
mu sync.RWMutex // guards the next block
121-
urls []string // set of URLs passed initially to the client
122-
running bool // true if the client's background processes are running
123-
errorlog Logger // error log for critical messages
124-
infolog Logger // information log for e.g. response times
125-
tracelog Logger // trace log for debugging
123+
mu sync.RWMutex // guards the next block
124+
urls []string // set of URLs passed initially to the client
125+
running bool // true if the client's background processes are running
126+
errorlog Logger // error log for critical messages
127+
infolog Logger // information log for e.g. response times
128+
tracelog Logger // trace log for debugging
129+
deprecationlog func(*http.Request, *http.Response)
126130
scheme string // http or https
127131
healthcheckEnabled bool // healthchecks enabled or disabled
128132
healthcheckTimeoutStartup time.Duration // time the healthcheck waits for a response from Elasticsearch on startup
@@ -245,6 +249,7 @@ func NewSimpleClient(options ...ClientOptionFunc) (*Client, error) {
245249
sendGetBodyAs: DefaultSendGetBodyAs,
246250
gzipEnabled: DefaultGzipEnabled,
247251
retrier: noRetries, // no retries by default
252+
deprecationlog: noDeprecationLog,
248253
}
249254

250255
// Run the options on it
@@ -330,6 +335,7 @@ func DialContext(ctx context.Context, options ...ClientOptionFunc) (*Client, err
330335
sendGetBodyAs: DefaultSendGetBodyAs,
331336
gzipEnabled: DefaultGzipEnabled,
332337
retrier: noRetries, // no retries by default
338+
deprecationlog: noDeprecationLog,
333339
}
334340

335341
// Run the options on it
@@ -1386,7 +1392,7 @@ func (c *Client) PerformRequest(ctx context.Context, opt PerformRequestOptions)
13861392

13871393
// Log deprecation warnings as errors
13881394
if len(res.Header["Warning"]) > 0 {
1389-
logDeprecation((*http.Request)(req), res)
1395+
c.deprecationlog((*http.Request)(req), res)
13901396
for _, warning := range res.Header["Warning"] {
13911397
c.errorf("Deprecation warning: %s", warning)
13921398
}
@@ -1483,9 +1489,9 @@ func (c *Client) Reindex() *ReindexService {
14831489

14841490
// TermVectors returns information and statistics on terms in the fields
14851491
// of a particular document.
1486-
func (c *Client) TermVectors(index, typ string) *TermvectorsService {
1492+
func (c *Client) TermVectors(index string) *TermvectorsService {
14871493
builder := NewTermvectorsService(c)
1488-
builder = builder.Index(index).Type(typ)
1494+
builder = builder.Index(index)
14891495
return builder
14901496
}
14911497

setup_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func setupTestClient(t logger, options ...ClientOptionFunc) (client *Client) {
319319

320320
// Log deprecations during tests
321321
if loglevel := *logDeprecations; loglevel != "off" {
322-
logDeprecation = func(req *http.Request, res *http.Response) {
322+
client.deprecationlog = func(req *http.Request, res *http.Response) {
323323
for _, warning := range res.Header["Warning"] {
324324
if !*logTypesRemoval && strings.Contains(warning, "[types removal]") {
325325
continue

termvectors.go

-3
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,6 @@ func (s *TermvectorsService) Validate() error {
325325
if s.index == "" {
326326
invalid = append(invalid, "Index")
327327
}
328-
if s.typ == "" {
329-
invalid = append(invalid, "Type")
330-
}
331328
if len(invalid) > 0 {
332329
return fmt.Errorf("missing required fields: %v", invalid)
333330
}

termvectors_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestTermVectorsBuildURL(t *testing.T) {
4646
}
4747

4848
for _, test := range tests {
49-
builder := client.TermVectors(test.Index, test.Type)
49+
builder := client.TermVectors(test.Index).Type(test.Type)
5050
if test.Id != "" {
5151
builder = builder.Id(test.Id)
5252
}
@@ -81,7 +81,7 @@ func TestTermVectorsWithId(t *testing.T) {
8181

8282
// TermVectors by specifying ID
8383
field := "Message"
84-
result, err := client.TermVectors(testIndexName, "_doc").
84+
result, err := client.TermVectors(testIndexName).
8585
Id("1").
8686
Fields(field).
8787
FieldStatistics(true).
@@ -115,7 +115,7 @@ func TestTermVectorsWithDoc(t *testing.T) {
115115
"fullname": "keyword",
116116
}
117117

118-
result, err := client.TermVectors(testIndexName, "_doc").
118+
result, err := client.TermVectors(testIndexName).
119119
Doc(doc).
120120
PerFieldAnalyzer(perFieldAnalyzer).
121121
FieldStatistics(true).
@@ -149,7 +149,7 @@ func TestTermVectorsWithFilter(t *testing.T) {
149149
"fullname": "keyword",
150150
}
151151

152-
result, err := client.TermVectors(testIndexName, "_doc").
152+
result, err := client.TermVectors(testIndexName).
153153
Doc(doc).
154154
PerFieldAnalyzer(perFieldAnalyzer).
155155
FieldStatistics(true).

0 commit comments

Comments
 (0)