elasticsearch 7.15.0 → 7.17.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: e17512df008ead07fcc1c4b5d127959ea5c2d0c8b900245600d7c8b7195234d0
|
4
|
+
data.tar.gz: b3b495229c695a1b8142051fa6868e051b20637ead9a6500991efdd7abaa6cd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e877a6669c39f6f4e24bbba43ee4fedc4c3dd63bca23e87988ec4ecb0806b9f282c44c7a82298bd9a6d417833a105b835b5bd74f55d7633d8114b46444f511f
|
7
|
+
data.tar.gz: 29cd41dc80a83f48b8617c3d8947ec2e89d85b8e4469600040c77c78c94a48b44c6add0c274f1f7f315b46b3e7dda499d711d8c9e86fc0422b9838312a78c73d
|
data/elasticsearch.gemspec
CHANGED
@@ -25,12 +25,12 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.authors = ['Karel Minarik']
|
26
26
|
s.email = ['karel.minarik@elasticsearch.org']
|
27
27
|
s.summary = 'Ruby integrations for Elasticsearch'
|
28
|
-
s.homepage = 'https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.
|
28
|
+
s.homepage = 'https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.16/index.html'
|
29
29
|
s.license = 'Apache-2.0'
|
30
30
|
s.metadata = {
|
31
|
-
'homepage_uri' => 'https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.
|
32
|
-
'changelog_uri' => 'https://github.com/elastic/elasticsearch-ruby/blob/7.
|
33
|
-
'source_code_uri' => 'https://github.com/elastic/elasticsearch-ruby/tree/7.
|
31
|
+
'homepage_uri' => 'https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.16/index.html',
|
32
|
+
'changelog_uri' => 'https://github.com/elastic/elasticsearch-ruby/blob/7.16/CHANGELOG.md',
|
33
|
+
'source_code_uri' => 'https://github.com/elastic/elasticsearch-ruby/tree/7.16',
|
34
34
|
'bug_tracker_uri' => 'https://github.com/elastic/elasticsearch-ruby/issues'
|
35
35
|
}
|
36
36
|
s.files = `git ls-files`.split($/)
|
@@ -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.
|
49
|
-
s.add_dependency 'elasticsearch-api', '7.
|
48
|
+
s.add_dependency 'elasticsearch-transport', '7.17.0'
|
49
|
+
s.add_dependency 'elasticsearch-api', '7.17.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
@@ -50,7 +50,8 @@ module Elasticsearch
|
|
50
50
|
begin
|
51
51
|
response = elasticsearch_validation_request
|
52
52
|
rescue Elasticsearch::Transport::Transport::Errors::Unauthorized,
|
53
|
-
Elasticsearch::Transport::Transport::Errors::Forbidden
|
53
|
+
Elasticsearch::Transport::Transport::Errors::Forbidden,
|
54
|
+
Elasticsearch::Transport::Transport::Errors::RequestEntityTooLarge
|
54
55
|
@verified = true
|
55
56
|
warn(SECURITY_PRIVILEGES_VALIDATION_WARNING)
|
56
57
|
return
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
ELASTICSEARCH_URL = ENV['TEST_ES_SERVER'] || "http://localhost:#{(ENV['PORT'] || 9200)}"
|
18
|
+
raise URI::InvalidURIError unless ELASTICSEARCH_URL =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
|
19
|
+
|
20
|
+
require 'spec_helper'
|
21
|
+
|
22
|
+
context 'Elasticsearch client' do
|
23
|
+
let(:client) do
|
24
|
+
Elasticsearch::Client.new(host: ELASTICSEARCH_URL, user: 'elastic', password: 'changeme')
|
25
|
+
end
|
26
|
+
let(:index) { 'tvs' }
|
27
|
+
|
28
|
+
after do
|
29
|
+
client.indices.delete(index: index)
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'escaping spaces in ids' do
|
33
|
+
it 'escapes spaces for id when using index' do
|
34
|
+
response = client.index(index: index, id: 'a test 1', body: { name: 'A test 1' }, refresh: true)
|
35
|
+
expect(response['_id']).to eq 'a test 1'
|
36
|
+
|
37
|
+
response = client.search(index: index)
|
38
|
+
expect(response['hits']['hits'].first['_id']).to eq 'a test 1'
|
39
|
+
|
40
|
+
# Raises exception, _id is unrecognized
|
41
|
+
expect do
|
42
|
+
client.index(index: index, _id: 'a test 2', body: { name: 'A test 2' })
|
43
|
+
end.to raise_exception ArgumentError
|
44
|
+
|
45
|
+
# Raises exception, id is a query parameter
|
46
|
+
expect do
|
47
|
+
client.index(index: index, body: { name: 'A test 3', _id: 'a test 3' })
|
48
|
+
end.to raise_exception Elasticsearch::Transport::Transport::Errors::BadRequest
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'escapes spaces for id when using create' do
|
52
|
+
# Works with create
|
53
|
+
response = client.create(index: index, id: 'a test 4', body: { name: 'A test 4' })
|
54
|
+
expect(response['_id']).to eq 'a test 4'
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'escapes spaces for id when using bulk' do
|
58
|
+
body = [
|
59
|
+
{ create: { _index: index, _id: 'a test 5', data: { name: 'A test 5' } } }
|
60
|
+
]
|
61
|
+
expect(client.bulk(body: body, refresh: true))
|
62
|
+
|
63
|
+
response = client.search(index: index)
|
64
|
+
expect(
|
65
|
+
response['hits']['hits'].select { |a| a['_id'] == 'a test 5' }.size
|
66
|
+
).to eq 1
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'it doesnae escape plus signs in id' do
|
71
|
+
it 'escapes spaces for id when using index' do
|
72
|
+
response = client.index(index: index, id: 'a+test+1', body: { name: 'A test 1' })
|
73
|
+
expect(response['_id']).to eq 'a+test+1'
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'escapes spaces for id when using create' do
|
77
|
+
# Works with create
|
78
|
+
response = client.create(index: index, id: 'a+test+2', body: { name: 'A test 2' })
|
79
|
+
expect(response['_id']).to eq 'a+test+2'
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'escapes spaces for id when using bulk' do
|
83
|
+
body = [
|
84
|
+
{ create: { _index: index, _id: 'a+test+3', data: { name: 'A test 3' } } }
|
85
|
+
]
|
86
|
+
expect(client.bulk(body: body, refresh: true))
|
87
|
+
|
88
|
+
response = client.search(index: index)
|
89
|
+
expect(
|
90
|
+
response['hits']['hits'].select { |a| a['_id'] == 'a+test+3' }.size
|
91
|
+
).to eq 1
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -25,7 +25,7 @@ describe 'Elasticsearch: Validation' do
|
|
25
25
|
.to_return(status: status, body: body, headers: headers)
|
26
26
|
end
|
27
27
|
let(:count_request_stub) do
|
28
|
-
stub_request(:
|
28
|
+
stub_request(:get, "#{host}/_count")
|
29
29
|
.to_return(status: 200, body: nil, headers: {})
|
30
30
|
end
|
31
31
|
let(:status) { 200 }
|
@@ -38,7 +38,7 @@ describe 'Elasticsearch: Validation' do
|
|
38
38
|
def error_requests_and_expectations(message = Elasticsearch::NOT_ELASTICSEARCH_WARNING)
|
39
39
|
expect { client.count }.to raise_error Elasticsearch::UnsupportedProductError, message
|
40
40
|
assert_requested :get, host
|
41
|
-
assert_not_requested :
|
41
|
+
assert_not_requested :get, "#{host}/_count"
|
42
42
|
expect { client.cluster.health }.to raise_error Elasticsearch::UnsupportedProductError, message
|
43
43
|
expect(client.instance_variable_get('@verified')).to be false
|
44
44
|
expect { client.cluster.health }.to raise_error Elasticsearch::UnsupportedProductError, message
|
@@ -51,7 +51,7 @@ describe 'Elasticsearch: Validation' do
|
|
51
51
|
client.count
|
52
52
|
expect(client.instance_variable_get('@verified'))
|
53
53
|
assert_requested :get, host
|
54
|
-
assert_requested :
|
54
|
+
assert_requested :get, "#{host}/_count"
|
55
55
|
end
|
56
56
|
|
57
57
|
context 'When Elasticsearch replies with status 401' do
|
@@ -96,6 +96,27 @@ describe 'Elasticsearch: Validation' do
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
context 'When Elasticsearch replies with status 403' do
|
100
|
+
let(:status) { 413 }
|
101
|
+
let(:body) { {}.to_json }
|
102
|
+
|
103
|
+
it 'Verifies the request but shows a warning' do
|
104
|
+
stderr = $stderr
|
105
|
+
fake_stderr = StringIO.new
|
106
|
+
$stderr = fake_stderr
|
107
|
+
|
108
|
+
verify_request_stub
|
109
|
+
count_request_stub
|
110
|
+
|
111
|
+
valid_requests_and_expectations
|
112
|
+
|
113
|
+
fake_stderr.rewind
|
114
|
+
expect(fake_stderr.string).to eq("#{Elasticsearch::SECURITY_PRIVILEGES_VALIDATION_WARNING}\n")
|
115
|
+
ensure
|
116
|
+
$stderr = stderr
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
99
120
|
context 'When the Elasticsearch version is >= 7.14' do
|
100
121
|
context 'With a valid Elasticsearch response' do
|
101
122
|
let(:body) { { 'version' => { 'number' => '7.14.0' } }.to_json }
|
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.
|
4
|
+
version: 7.17.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:
|
11
|
+
date: 2022-02-01 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.
|
19
|
+
version: 7.17.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.
|
26
|
+
version: 7.17.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.
|
33
|
+
version: 7.17.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.
|
40
|
+
version: 7.17.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,18 +200,19 @@ files:
|
|
200
200
|
- lib/elasticsearch-ruby.rb
|
201
201
|
- lib/elasticsearch.rb
|
202
202
|
- lib/elasticsearch/version.rb
|
203
|
+
- spec/integration/characters_escaping_spec.rb
|
203
204
|
- spec/integration/client_integration_spec.rb
|
204
205
|
- spec/integration/validation_integration_spec.rb
|
205
206
|
- spec/spec_helper.rb
|
206
207
|
- spec/unit/elasticsearch_product_validation_spec.rb
|
207
208
|
- spec/unit/wrapper_gem_spec.rb
|
208
|
-
homepage: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.
|
209
|
+
homepage: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.16/index.html
|
209
210
|
licenses:
|
210
211
|
- Apache-2.0
|
211
212
|
metadata:
|
212
|
-
homepage_uri: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.
|
213
|
-
changelog_uri: https://github.com/elastic/elasticsearch-ruby/blob/7.
|
214
|
-
source_code_uri: https://github.com/elastic/elasticsearch-ruby/tree/7.
|
213
|
+
homepage_uri: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.16/index.html
|
214
|
+
changelog_uri: https://github.com/elastic/elasticsearch-ruby/blob/7.16/CHANGELOG.md
|
215
|
+
source_code_uri: https://github.com/elastic/elasticsearch-ruby/tree/7.16
|
215
216
|
bug_tracker_uri: https://github.com/elastic/elasticsearch-ruby/issues
|
216
217
|
post_install_message:
|
217
218
|
rdoc_options:
|
@@ -229,11 +230,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
230
|
- !ruby/object:Gem::Version
|
230
231
|
version: '0'
|
231
232
|
requirements: []
|
232
|
-
rubygems_version: 3.
|
233
|
+
rubygems_version: 3.1.6
|
233
234
|
signing_key:
|
234
235
|
specification_version: 4
|
235
236
|
summary: Ruby integrations for Elasticsearch
|
236
237
|
test_files:
|
238
|
+
- spec/integration/characters_escaping_spec.rb
|
237
239
|
- spec/integration/client_integration_spec.rb
|
238
240
|
- spec/integration/validation_integration_spec.rb
|
239
241
|
- spec/spec_helper.rb
|