elasticsearch 7.16.1 → 7.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/elasticsearch.gemspec +2 -2
- data/lib/elasticsearch/version.rb +1 -1
- data/spec/integration/characters_escaping_spec.rb +94 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ea82287d3f188a99c931c7d9f7a9b85ba249fd7bada5a2634be5ac547243d7f
|
4
|
+
data.tar.gz: f699d2dde8df851cd99b5e05e4663057219e9f99350aa36634dd4edfa8453816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ec0ff600a3a150fef2f7d1c4f73d2aefe38a07a9771b0232dcf0c08396b43a38bf60407c9a1e1861e379b99f7e327b910dc2ffad687eda9c9631a9ce63388e9
|
7
|
+
data.tar.gz: 260fadf2c1043c66c272910def2afcc75fe9bc8b59a0cc941e1458c5ec4cffc07bc53d58e0aad5b18f7ccd9bf7ade6d6df391462e3c15638beaa6aace13c8c2d
|
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.16.
|
49
|
-
s.add_dependency 'elasticsearch-api', '7.16.
|
48
|
+
s.add_dependency 'elasticsearch-transport', '7.16.3'
|
49
|
+
s.add_dependency 'elasticsearch-api', '7.16.3'
|
50
50
|
|
51
51
|
s.add_development_dependency 'bundler'
|
52
52
|
s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
|
@@ -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
|
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.16.
|
4
|
+
version: 7.16.3
|
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-01-13 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.16.
|
19
|
+
version: 7.16.3
|
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.16.
|
26
|
+
version: 7.16.3
|
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.16.
|
33
|
+
version: 7.16.3
|
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.16.
|
40
|
+
version: 7.16.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,6 +200,7 @@ 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
|
@@ -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.3.3
|
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
|