elasticsearch 7.14.0.pre → 7.14.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716743889b9b5e25022814cceb17d97ac242891c91ca86f8de4dd77003ee8e13
|
4
|
+
data.tar.gz: e11579ee6907a87f131b689979e6c35df9079177bbf7df0419370c2294f8d86b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53f6244770f02a67315852e6d67cab6f13f6b7ce72ea8c60a93caf2a4ddc47eeb4764ca2fd65cc74413cb4f90f0f1f1792697f874dd0bffa754c9bd1c8fa1cb6
|
7
|
+
data.tar.gz: daac32d9daac91a0353bbe73ccdbdee5fdb47a39b41f63c4b2fbd50fa532ee1f5771b371053c417e968f98a6e44bbb55da79f09dd1e4f6ad63d5f9b7145b46fc
|
data/elasticsearch.gemspec
CHANGED
@@ -45,8 +45,8 @@ Gem::Specification.new do |s|
|
|
45
45
|
|
46
46
|
s.required_ruby_version = '>= 2.4'
|
47
47
|
|
48
|
-
s.add_dependency 'elasticsearch-transport', '7.14.0
|
49
|
-
s.add_dependency 'elasticsearch-api', '7.14.0
|
48
|
+
s.add_dependency 'elasticsearch-transport', '7.14.0'
|
49
|
+
s.add_dependency 'elasticsearch-api', '7.14.0'
|
50
50
|
|
51
51
|
s.add_development_dependency 'bundler'
|
52
52
|
s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
|
data/lib/elasticsearch.rb
CHANGED
@@ -20,9 +20,10 @@ require 'elasticsearch/transport'
|
|
20
20
|
require 'elasticsearch/api'
|
21
21
|
|
22
22
|
module Elasticsearch
|
23
|
-
SECURITY_PRIVILEGES_VALIDATION_WARNING = 'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side.'.freeze
|
23
|
+
SECURITY_PRIVILEGES_VALIDATION_WARNING = 'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.'.freeze
|
24
24
|
NOT_ELASTICSEARCH_WARNING = 'The client noticed that the server is not Elasticsearch and we do not support this unknown product.'.freeze
|
25
|
-
|
25
|
+
NOT_SUPPORTED_ELASTICSEARCH_WARNING = 'The client noticed that the server is not a supported distribution of Elasticsearch.'.freeze
|
26
|
+
YOU_KNOW_FOR_SEARCH = 'You Know, for Search'.freeze
|
26
27
|
|
27
28
|
class Client
|
28
29
|
include Elasticsearch::API
|
@@ -66,23 +67,22 @@ module Elasticsearch
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def verify_with_version_or_header(body, version, headers)
|
69
|
-
raise Elasticsearch::
|
70
|
+
raise Elasticsearch::UnsupportedProductError if version.nil? || version < '6.0.0'
|
70
71
|
|
71
72
|
if version == '7.x-SNAPSHOT' || Gem::Version.new(version) >= Gem::Version.new('7.14-SNAPSHOT')
|
72
|
-
raise Elasticsearch::
|
73
|
+
raise Elasticsearch::UnsupportedProductError unless headers['x-elastic-product'] == 'Elasticsearch'
|
73
74
|
|
74
75
|
@verified = true
|
75
76
|
elsif Gem::Version.new(version) > Gem::Version.new('6.0.0') &&
|
76
77
|
Gem::Version.new(version) < Gem::Version.new('7.0.0')
|
77
|
-
raise Elasticsearch::
|
78
|
+
raise Elasticsearch::UnsupportedProductError unless
|
78
79
|
body['tagline'] == YOU_KNOW_FOR_SEARCH
|
79
80
|
|
80
81
|
@verified = true
|
81
82
|
elsif Gem::Version.new(version) >= Gem::Version.new('7.0.0') &&
|
82
83
|
Gem::Version.new(version) < Gem::Version.new('7.14-SNAPSHOT')
|
83
|
-
raise Elasticsearch::
|
84
|
-
|
85
|
-
body.dig('version', 'build_flavor') == 'default'
|
84
|
+
raise Elasticsearch::UnsupportedProductError unless body['tagline'] == YOU_KNOW_FOR_SEARCH
|
85
|
+
raise Elasticsearch::UnsupportedProductError.new(NOT_SUPPORTED_ELASTICSEARCH_WARNING) unless body.dig('version', 'build_flavor') == 'default'
|
86
86
|
|
87
87
|
@verified = true
|
88
88
|
end
|
@@ -93,9 +93,9 @@ module Elasticsearch
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
class
|
97
|
-
def initialize
|
98
|
-
super(
|
96
|
+
class UnsupportedProductError < StandardError
|
97
|
+
def initialize(message = NOT_ELASTICSEARCH_WARNING)
|
98
|
+
super(message)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -51,7 +51,7 @@ context 'Elasticsearch client' do
|
|
51
51
|
context 'Reports the right meta header' do
|
52
52
|
it 'Reports es service name and gem version' do
|
53
53
|
headers = client.transport.transport.connections.first.connection.headers
|
54
|
-
expect(headers['x-elastic-client-meta']).to match
|
54
|
+
expect(headers['x-elastic-client-meta']).to match /^es=#{Elasticsearch::VERSION}/
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -35,13 +35,13 @@ describe 'Elasticsearch: Validation' do
|
|
35
35
|
{ 'content-type' => 'json' }
|
36
36
|
end
|
37
37
|
|
38
|
-
def error_requests_and_expectations
|
39
|
-
expect { client.count }.to raise_error Elasticsearch::
|
38
|
+
def error_requests_and_expectations(message = Elasticsearch::NOT_ELASTICSEARCH_WARNING)
|
39
|
+
expect { client.count }.to raise_error Elasticsearch::UnsupportedProductError, message
|
40
40
|
assert_requested :get, host
|
41
41
|
assert_not_requested :post, "#{host}/_count"
|
42
|
-
expect { client.cluster.health }.to raise_error Elasticsearch::
|
42
|
+
expect { client.cluster.health }.to raise_error Elasticsearch::UnsupportedProductError, message
|
43
43
|
expect(client.instance_variable_get('@verified')).to be false
|
44
|
-
expect { client.cluster.health }.to raise_error Elasticsearch::
|
44
|
+
expect { client.cluster.health }.to raise_error Elasticsearch::UnsupportedProductError, message
|
45
45
|
end
|
46
46
|
|
47
47
|
def valid_requests_and_expectations
|
@@ -105,6 +105,7 @@ describe 'Elasticsearch: Validation' do
|
|
105
105
|
'content-type' => 'json'
|
106
106
|
}
|
107
107
|
end
|
108
|
+
|
108
109
|
it 'Makes requests and passes validation' do
|
109
110
|
verify_request_stub
|
110
111
|
count_request_stub
|
@@ -134,6 +135,7 @@ describe 'Elasticsearch: Validation' do
|
|
134
135
|
'content-type' => 'json'
|
135
136
|
}
|
136
137
|
end
|
138
|
+
|
137
139
|
it 'Makes requests and passes validation' do
|
138
140
|
verify_request_stub
|
139
141
|
count_request_stub
|
@@ -234,6 +236,25 @@ describe 'Elasticsearch: Validation' do
|
|
234
236
|
}.to_json
|
235
237
|
end
|
236
238
|
|
239
|
+
it 'Fails validation' do
|
240
|
+
verify_request_stub
|
241
|
+
count_request_stub
|
242
|
+
|
243
|
+
error_requests_and_expectations(Elasticsearch::NOT_SUPPORTED_ELASTICSEARCH_WARNING)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
context 'When the tagline is different' do
|
248
|
+
let(:body) do
|
249
|
+
{
|
250
|
+
'version' => {
|
251
|
+
'number' => '7.4.0',
|
252
|
+
'build_flavor' => 'default'
|
253
|
+
},
|
254
|
+
'tagline' => 'You Know, for other stuff'
|
255
|
+
}.to_json
|
256
|
+
end
|
257
|
+
|
237
258
|
it 'Fails validation' do
|
238
259
|
verify_request_stub
|
239
260
|
count_request_stub
|
@@ -249,7 +270,7 @@ describe 'Elasticsearch: Validation' do
|
|
249
270
|
'number' => '7.4.0',
|
250
271
|
'build_flavor' => 'default'
|
251
272
|
},
|
252
|
-
'tagline' =>
|
273
|
+
'tagline' => 'You Know, for Search'
|
253
274
|
}.to_json
|
254
275
|
end
|
255
276
|
|
@@ -286,7 +307,7 @@ describe 'Elasticsearch: Validation' do
|
|
286
307
|
'version' => {
|
287
308
|
'number' => '6.8.10'
|
288
309
|
},
|
289
|
-
'tagline' =>
|
310
|
+
'tagline' => 'You Know, for Search'
|
290
311
|
}.to_json
|
291
312
|
end
|
292
313
|
|
@@ -310,6 +331,25 @@ describe 'Elasticsearch: Validation' do
|
|
310
331
|
error_requests_and_expectations
|
311
332
|
end
|
312
333
|
end
|
334
|
+
|
335
|
+
context 'When the tagline is different' do
|
336
|
+
let(:body) do
|
337
|
+
{
|
338
|
+
'version' => {
|
339
|
+
'number' => '6.8.10',
|
340
|
+
'build_flavor' => 'default'
|
341
|
+
},
|
342
|
+
'tagline' => 'You Know, for Stuff'
|
343
|
+
}.to_json
|
344
|
+
end
|
345
|
+
|
346
|
+
it 'Fails validation' do
|
347
|
+
verify_request_stub
|
348
|
+
count_request_stub
|
349
|
+
|
350
|
+
error_requests_and_expectations
|
351
|
+
end
|
352
|
+
end
|
313
353
|
end
|
314
354
|
|
315
355
|
context 'When Elasticsearch version is between 7.0.0 and 7.14.0' do
|
@@ -320,7 +360,7 @@ describe 'Elasticsearch: Validation' do
|
|
320
360
|
'number' => '7.10.0',
|
321
361
|
'build_flavor' => 'default'
|
322
362
|
},
|
323
|
-
'tagline' =>
|
363
|
+
'tagline' => 'You Know, for Search'
|
324
364
|
}.to_json
|
325
365
|
end
|
326
366
|
|
@@ -350,13 +390,32 @@ describe 'Elasticsearch: Validation' do
|
|
350
390
|
end
|
351
391
|
end
|
352
392
|
|
393
|
+
context 'When the tagline is different' do
|
394
|
+
let(:body) do
|
395
|
+
{
|
396
|
+
'version' => {
|
397
|
+
'number' => '7.10.0',
|
398
|
+
'build_flavor' => 'default'
|
399
|
+
},
|
400
|
+
'tagline' => 'You Know, for other stuff'
|
401
|
+
}.to_json
|
402
|
+
end
|
403
|
+
|
404
|
+
it 'Fails validation' do
|
405
|
+
verify_request_stub
|
406
|
+
count_request_stub
|
407
|
+
|
408
|
+
error_requests_and_expectations
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
353
412
|
context 'When the build_flavor is not present' do
|
354
413
|
let(:body) do
|
355
414
|
{
|
356
415
|
'version' => {
|
357
416
|
'number' => '7.10.0'
|
358
417
|
},
|
359
|
-
'tagline' =>
|
418
|
+
'tagline' => 'You Know, for Search'
|
360
419
|
}.to_json
|
361
420
|
end
|
362
421
|
|
@@ -364,7 +423,7 @@ describe 'Elasticsearch: Validation' do
|
|
364
423
|
verify_request_stub
|
365
424
|
count_request_stub
|
366
425
|
|
367
|
-
error_requests_and_expectations
|
426
|
+
error_requests_and_expectations(Elasticsearch::NOT_SUPPORTED_ELASTICSEARCH_WARNING)
|
368
427
|
end
|
369
428
|
end
|
370
429
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.14.0
|
4
|
+
version: 7.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch-transport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.14.0
|
19
|
+
version: 7.14.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.14.0
|
26
|
+
version: 7.14.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: elasticsearch-api
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 7.14.0
|
33
|
+
version: 7.14.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 7.14.0
|
40
|
+
version: 7.14.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -225,9 +225,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
225
|
version: '2.4'
|
226
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
227
|
requirements:
|
228
|
-
- - "
|
228
|
+
- - ">="
|
229
229
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
230
|
+
version: '0'
|
231
231
|
requirements: []
|
232
232
|
rubygems_version: 3.2.15
|
233
233
|
signing_key:
|