Skip to content

Commit a2132ac

Browse files
committed
Updates dependency on elasticsearch gem to 8
Replaces Elasticsearch::Transport with Elastic::Transport
1 parent bec2e77 commit a2132ac

File tree

12 files changed

+23
-26
lines changed

12 files changed

+23
-26
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ source 'https://rubygems.org'
1919

2020
gem 'ansi'
2121
gem 'cane'
22-
gem 'elasticsearch', '~> 7'
22+
gem 'elasticsearch', '~> 8'
2323
gem 'pry'
2424
gem 'rake', '~> 12'
2525

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ task :wait_for_green do
163163
ready = true
164164
break
165165
end
166-
rescue Elasticsearch::Transport::Transport::Errors::RequestTimeout => ex
166+
rescue Elastic::Transport::Transport::Errors::RequestTimeout => ex
167167
puts "Couldn't confirm green status.\n#{ex.inspect}."
168168
rescue Faraday::ConnectionFailed => ex
169169
puts "Couldn't connect to Elasticsearch.\n#{ex.inspect}."

elasticsearch-model/README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ It aims to simplify integration of Ruby classes ("models"), commonly found e.g.
66

77
## Compatibility
88

9-
This library is compatible with Ruby 2.4 and higher.
9+
This library is compatible with Ruby 3 and higher.
1010

1111
The version numbers follow the Elasticsearch major versions. Currently the `main` branch is compatible with version `7.x` of the Elasticsearch stack. **We haven't tested and updated the code for Elasticsearch `8.0` yet**.
1212

13-
| Rubygem | | Elasticsearch |
14-
|:-------------:|:-:| :-----------: |
15-
| 0.1 || 1.x |
16-
| 2.x || 2.x |
17-
| 5.x || 5.x |
18-
| 6.x || 6.x |
19-
| 7.x || 7.x |
20-
| main || 7.x |
13+
| Rubygem | | Elasticsearch |
14+
|:-------:|:-:|:-------------:|
15+
| 0.1 || 1.x |
16+
| 2.x || 2.x |
17+
| 5.x || 5.x |
18+
| 6.x || 6.x |
19+
| 7.x || 7.x |
20+
| 8.x || 8.x |
21+
| main || 8.x |
2122

2223
## Installation
2324

@@ -532,7 +533,7 @@ class Indexer
532533
when /delete/
533534
begin
534535
Client.delete index: 'articles', type: 'article', id: record_id
535-
rescue Elasticsearch::Transport::Transport::Errors::NotFound
536+
rescue Elastic::Transport::Transport::Errors::NotFound
536537
logger.debug "Article not found, ID: #{record_id}"
537538
end
538539
else raise ArgumentError, "Unknown operation '#{operation}'"

elasticsearch-model/elasticsearch-model.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
4242
s.required_ruby_version = '>= 3'
4343

4444
s.add_dependency 'activesupport', '> 3'
45-
s.add_dependency 'elasticsearch', '~> 7'
45+
s.add_dependency 'elasticsearch', '~> 8'
4646
s.add_dependency 'hashie'
4747

4848
s.add_development_dependency 'activemodel', '> 3'

elasticsearch-model/lib/elasticsearch/model/importing.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ def __batch_to_bulk(batch, transform)
185185
batch.map { |model| transform.call(model) }
186186
end
187187
end
188-
189188
end
190-
191189
end
192190
end

elasticsearch-model/lib/elasticsearch/model/multimodel.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def document_type
9090

9191
# Get the client common for all models
9292
#
93-
# @return Elasticsearch::Transport::Client
93+
# @return Elastic::Transport::Client
9494
#
9595
def client
9696
Elasticsearch::Model.client

elasticsearch-model/spec/elasticsearch/model/adapters/active_record/basic_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
describe Elasticsearch::Model::Adapter::ActiveRecord do
2121

2222
context 'when a document_type is not defined for the Model' do
23-
2423
before do
2524
ActiveRecord::Schema.define(:version => 1) do
2625
create_table :article_no_types do |t|

elasticsearch-model/spec/elasticsearch/model/indexing_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ class ::DummyIndexingModelForRecreate
678678
context 'when the index is not found' do
679679
let(:logger) { nil }
680680
let(:transport) do
681-
Elasticsearch::Transport::Client.new(logger: logger)
681+
Elastic::Transport::Client.new(logger: logger)
682682
end
683683

684684
let(:client) do
@@ -918,7 +918,7 @@ class ::DummyIndexingModelForRefresh
918918
end
919919

920920
let(:transport) do
921-
Elasticsearch::Transport::Client.new(logger: nil)
921+
Elastic::Transport::Client.new(logger: nil)
922922
end
923923

924924
let(:indices) do
@@ -949,7 +949,7 @@ class ::DummyIndexingModelForRefresh
949949
end
950950

951951
let(:transport) do
952-
Elasticsearch::Transport::Client.new(logger: logger)
952+
Elastic::Transport::Client.new(logger: logger)
953953
end
954954

955955
it 'does not raise an exception' do

elasticsearch-model/spec/elasticsearch/model/response/result_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
require 'active_support/json/encoding'
2020

2121
describe Elasticsearch::Model::Response::Result do
22-
2322
let(:result) do
2423
described_class.new(foo: 'bar', bar: { bam: 'baz' })
2524
end

elasticsearch-persistence/lib/elasticsearch/persistence/repository/find.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def __find_one(id, options={})
8787
request[:type] = document_type if document_type
8888
document = client.get(request.merge(options))
8989
deserialize(document)
90-
rescue Elasticsearch::Transport::Transport::Errors::NotFound => e
90+
rescue Elastic::Transport::Transport::Errors::NotFound => e
9191
raise DocumentNotFound, e.message, caller
9292
end
9393

0 commit comments

Comments
 (0)