elasticsearch 7.14.1 → 7.16.3

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: eeb9b8e4fea7d4902ba4133cd06f4bc07f8e47bf6a4fa34cf22c9e631c71ee39
4
- data.tar.gz: 2b4f36b5a32a9b43ac43ae4128595905d7ad76d561eabc7cef2263c5beebd094
3
+ metadata.gz: 1ea82287d3f188a99c931c7d9f7a9b85ba249fd7bada5a2634be5ac547243d7f
4
+ data.tar.gz: f699d2dde8df851cd99b5e05e4663057219e9f99350aa36634dd4edfa8453816
5
5
  SHA512:
6
- metadata.gz: af4069218616fe06d7b005632503860613b5f224a1e15d24c2375ad458c01bef0a2c5a93b25807f2df1010bb80bd1c7a88f51dc278a7c8e1db8a27a2f3332876
7
- data.tar.gz: 4b1555a7c6c781c4a6eb74b5dbd343e25af9216d11eb571d9c80b57036d062e1f35fa8454f8ad4cca60f74623967e2d8f5c2604ced71d06f8db175d1a33b23ee
6
+ metadata.gz: 2ec0ff600a3a150fef2f7d1c4f73d2aefe38a07a9771b0232dcf0c08396b43a38bf60407c9a1e1861e379b99f7e327b910dc2ffad687eda9c9631a9ce63388e9
7
+ data.tar.gz: 260fadf2c1043c66c272910def2afcc75fe9bc8b59a0cc941e1458c5ec4cffc07bc53d58e0aad5b18f7ccd9bf7ade6d6df391462e3c15638beaa6aace13c8c2d
@@ -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.x/index.html'
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.x/index.html',
32
- 'changelog_uri' => 'https://github.com/elastic/elasticsearch-ruby/blob/7.x/CHANGELOG.md',
33
- 'source_code_uri' => 'https://github.com/elastic/elasticsearch-ruby/tree/7.x',
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.14.1'
49
- s.add_dependency 'elasticsearch-api', '7.14.1'
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)
@@ -16,5 +16,5 @@
16
16
  # under the License.
17
17
 
18
18
  module Elasticsearch
19
- VERSION = '7.14.1'.freeze
19
+ VERSION = '7.16.3'.freeze
20
20
  end
@@ -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
@@ -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 /^es=#{Elasticsearch::VERSION}/
54
+ expect(headers['x-elastic-client-meta']).to match Elastic.client_meta_version
55
55
  end
56
56
  end
57
57
  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(:post, "#{host}/_count")
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 :post, "#{host}/_count"
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 :post, "#{host}/_count"
54
+ assert_requested :get, "#{host}/_count"
55
55
  end
56
56
 
57
57
  context 'When Elasticsearch replies with status 401' do
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.1
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: 2021-09-06 00:00:00.000000000 Z
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.14.1
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.14.1
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.14.1
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.14.1
40
+ version: 7.16.3
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.x/index.html
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.x/index.html
213
- changelog_uri: https://github.com/elastic/elasticsearch-ruby/blob/7.x/CHANGELOG.md
214
- source_code_uri: https://github.com/elastic/elasticsearch-ruby/tree/7.x
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.2.22
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