elasticsearch 7.17.11 → 8.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -10
- data/README.md +70 -31
- data/bin/elastic_ruby_console +2 -5
- data/elasticsearch.gemspec +14 -14
- data/lib/elasticsearch/version.rb +1 -1
- data/lib/elasticsearch.rb +97 -33
- data/spec/integration/client_integration_spec.rb +10 -4
- data/spec/spec_helper.rb +8 -3
- data/spec/unit/api_key_spec.rb +101 -0
- data/spec/unit/cloud_credentials_spec.rb +167 -0
- data/spec/unit/custom_transport_implementation_spec.rb +43 -0
- data/spec/unit/elasticsearch_product_validation_spec.rb +17 -233
- data/spec/unit/headers_spec.rb +55 -0
- data/spec/unit/opaque_id_spec.rb +48 -0
- data/spec/unit/wrapper_gem_spec.rb +4 -10
- metadata +31 -25
- data/spec/integration/characters_escaping_spec.rb +0 -97
- data/spec/integration/validation_integration_spec.rb +0 -30
- /data/{LICENSE → LICENSE.txt} +0 -0
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0.pre1
|
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: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: elastic-transport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 8.0.0.pre2
|
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:
|
26
|
+
version: 8.0.0.pre2
|
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:
|
33
|
+
version: 8.0.0.pre1
|
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:
|
40
|
+
version: 8.0.0.pre1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: require-prof
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,11 +188,11 @@ executables:
|
|
188
188
|
extensions: []
|
189
189
|
extra_rdoc_files:
|
190
190
|
- README.md
|
191
|
-
- LICENSE
|
191
|
+
- LICENSE.txt
|
192
192
|
files:
|
193
193
|
- ".gitignore"
|
194
194
|
- Gemfile
|
195
|
-
- LICENSE
|
195
|
+
- LICENSE.txt
|
196
196
|
- README.md
|
197
197
|
- Rakefile
|
198
198
|
- bin/elastic_ruby_console
|
@@ -200,19 +200,22 @@ 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
|
204
203
|
- spec/integration/client_integration_spec.rb
|
205
|
-
- spec/integration/validation_integration_spec.rb
|
206
204
|
- spec/spec_helper.rb
|
205
|
+
- spec/unit/api_key_spec.rb
|
206
|
+
- spec/unit/cloud_credentials_spec.rb
|
207
|
+
- spec/unit/custom_transport_implementation_spec.rb
|
207
208
|
- spec/unit/elasticsearch_product_validation_spec.rb
|
209
|
+
- spec/unit/headers_spec.rb
|
210
|
+
- spec/unit/opaque_id_spec.rb
|
208
211
|
- spec/unit/wrapper_gem_spec.rb
|
209
|
-
homepage: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/
|
212
|
+
homepage: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/current/index.html
|
210
213
|
licenses:
|
211
214
|
- Apache-2.0
|
212
215
|
metadata:
|
213
|
-
homepage_uri: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/
|
214
|
-
changelog_uri: https://github.com/elastic/elasticsearch-ruby/blob/
|
215
|
-
source_code_uri: https://github.com/elastic/elasticsearch-ruby/tree/
|
216
|
+
homepage_uri: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/current/index.html
|
217
|
+
changelog_uri: https://github.com/elastic/elasticsearch-ruby/blob/main/CHANGELOG.md
|
218
|
+
source_code_uri: https://github.com/elastic/elasticsearch-ruby/tree/main
|
216
219
|
bug_tracker_uri: https://github.com/elastic/elasticsearch-ruby/issues
|
217
220
|
post_install_message:
|
218
221
|
rdoc_options:
|
@@ -223,21 +226,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
226
|
requirements:
|
224
227
|
- - ">="
|
225
228
|
- !ruby/object:Gem::Version
|
226
|
-
version: '2.
|
229
|
+
version: '2.5'
|
227
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
231
|
requirements:
|
229
|
-
- - "
|
232
|
+
- - ">"
|
230
233
|
- !ruby/object:Gem::Version
|
231
|
-
version:
|
234
|
+
version: 1.3.1
|
232
235
|
requirements: []
|
233
|
-
rubygems_version: 3.
|
236
|
+
rubygems_version: 3.2.22
|
234
237
|
signing_key:
|
235
238
|
specification_version: 4
|
236
239
|
summary: Ruby integrations for Elasticsearch
|
237
240
|
test_files:
|
238
|
-
- spec/integration/characters_escaping_spec.rb
|
239
241
|
- spec/integration/client_integration_spec.rb
|
240
|
-
- spec/integration/validation_integration_spec.rb
|
241
242
|
- spec/spec_helper.rb
|
243
|
+
- spec/unit/api_key_spec.rb
|
244
|
+
- spec/unit/cloud_credentials_spec.rb
|
245
|
+
- spec/unit/custom_transport_implementation_spec.rb
|
242
246
|
- spec/unit/elasticsearch_product_validation_spec.rb
|
247
|
+
- spec/unit/headers_spec.rb
|
248
|
+
- spec/unit/opaque_id_spec.rb
|
243
249
|
- spec/unit/wrapper_gem_spec.rb
|
@@ -1,97 +0,0 @@
|
|
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
|
-
|
18
|
-
require 'uri'
|
19
|
-
|
20
|
-
ELASTICSEARCH_URL = ENV['TEST_ES_SERVER'] || "http://localhost:#{(ENV['PORT'] || 9200)}"
|
21
|
-
raise URI::InvalidURIError unless ELASTICSEARCH_URL =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
|
22
|
-
|
23
|
-
require 'spec_helper'
|
24
|
-
|
25
|
-
context 'Elasticsearch client' do
|
26
|
-
let(:client) do
|
27
|
-
Elasticsearch::Client.new(host: ELASTICSEARCH_URL, user: 'elastic', password: 'changeme')
|
28
|
-
end
|
29
|
-
let(:index) { 'tvs' }
|
30
|
-
|
31
|
-
after do
|
32
|
-
client.indices.delete(index: index)
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'escaping spaces in ids' do
|
36
|
-
it 'escapes spaces for id when using index' do
|
37
|
-
response = client.index(index: index, id: 'a test 1', body: { name: 'A test 1' }, refresh: true)
|
38
|
-
expect(response['_id']).to eq 'a test 1'
|
39
|
-
|
40
|
-
response = client.search(index: index)
|
41
|
-
expect(response['hits']['hits'].first['_id']).to eq 'a test 1'
|
42
|
-
|
43
|
-
# Raises exception, _id is unrecognized
|
44
|
-
expect do
|
45
|
-
client.index(index: index, _id: 'a test 2', body: { name: 'A test 2' })
|
46
|
-
end.to raise_exception ArgumentError
|
47
|
-
|
48
|
-
# Raises exception, id is a query parameter
|
49
|
-
expect do
|
50
|
-
client.index(index: index, body: { name: 'A test 3', _id: 'a test 3' })
|
51
|
-
end.to raise_exception Elasticsearch::Transport::Transport::Errors::BadRequest
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'escapes spaces for id when using create' do
|
55
|
-
# Works with create
|
56
|
-
response = client.create(index: index, id: 'a test 4', body: { name: 'A test 4' })
|
57
|
-
expect(response['_id']).to eq 'a test 4'
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'escapes spaces for id when using bulk' do
|
61
|
-
body = [
|
62
|
-
{ create: { _index: index, _id: 'a test 5', data: { name: 'A test 5' } } }
|
63
|
-
]
|
64
|
-
expect(client.bulk(body: body, refresh: true))
|
65
|
-
|
66
|
-
response = client.search(index: index)
|
67
|
-
expect(
|
68
|
-
response['hits']['hits'].select { |a| a['_id'] == 'a test 5' }.size
|
69
|
-
).to eq 1
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context 'it doesnae escape plus signs in id' do
|
74
|
-
it 'escapes spaces for id when using index' do
|
75
|
-
response = client.index(index: index, id: 'a+test+1', body: { name: 'A test 1' })
|
76
|
-
expect(response['_id']).to eq 'a+test+1'
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'escapes spaces for id when using create' do
|
80
|
-
# Works with create
|
81
|
-
response = client.create(index: index, id: 'a+test+2', body: { name: 'A test 2' })
|
82
|
-
expect(response['_id']).to eq 'a+test+2'
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'escapes spaces for id when using bulk' do
|
86
|
-
body = [
|
87
|
-
{ create: { _index: index, _id: 'a+test+3', data: { name: 'A test 3' } } }
|
88
|
-
]
|
89
|
-
expect(client.bulk(body: body, refresh: true))
|
90
|
-
|
91
|
-
response = client.search(index: index)
|
92
|
-
expect(
|
93
|
-
response['hits']['hits'].select { |a| a['_id'] == 'a+test+3' }.size
|
94
|
-
).to eq 1
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,30 +0,0 @@
|
|
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
|
-
require 'spec_helper'
|
18
|
-
require 'logger'
|
19
|
-
|
20
|
-
describe 'Elasticsearch validation integration' do
|
21
|
-
it 'Validates for Elasticsearch > 7.14' do
|
22
|
-
client = Elasticsearch::Client.new(
|
23
|
-
host: ELASTICSEARCH_URL,
|
24
|
-
logger: Logger.new($stderr)
|
25
|
-
)
|
26
|
-
expect(client.instance_variable_get('@verified')).to be false
|
27
|
-
client.count
|
28
|
-
expect(client.instance_variable_get('@verified')).to be true
|
29
|
-
end
|
30
|
-
end
|
/data/{LICENSE → LICENSE.txt}
RENAMED
File without changes
|