elasticsearch-rails 7.2.1 → 8.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -1
- data/README.md +2 -3
- data/Rakefile +2 -0
- data/elasticsearch-rails.gemspec +3 -3
- data/lib/elasticsearch/rails/tasks/import.rb +2 -2
- data/lib/elasticsearch/rails/version.rb +1 -1
- data/lib/rails/templates/01-basic.rb +2 -2
- data/lib/rails/templates/04-dsl.rb +2 -2
- data/lib/rails/templates/indexer.rb +1 -1
- data/spec/instrumentation_spec.rb +21 -16
- data/spec/lograge_spec.rb +5 -4
- data/spec/spec_helper.rb +2 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64ebf5844db4e95b8dfe3713ca0059c700d6a75907f96de772f0446c07e4f5da
|
4
|
+
data.tar.gz: 290065237c0e894f0d905b2f74a867fb8a2fff13cd6a0c9f7bbe3a0a5681382f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3e5e62c7a52f4bd25ea892f3336f9b27d66b04a1599cab018e44565b594b562a5fb906234cacc23b7eb6898455f1c2f6064737493754c4c779059d997467ef4
|
7
|
+
data.tar.gz: 2c02e8ba745189d9d38996d4b5d6dc25de0b45cbe00cde33a37fc6cca033404e5a81d67f2ea77a9c62c66864cc6cee8542214a9ead2f51378be7995a0d05546f
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,8 +8,7 @@ library, providing features suitable for Ruby on Rails applications.
|
|
8
8
|
|
9
9
|
This library is compatible with Ruby 1.9.3 and higher.
|
10
10
|
|
11
|
-
The
|
12
|
-
is compatible with the Elasticsearch `master` branch, therefore, with the next major version.
|
11
|
+
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**.
|
13
12
|
|
14
13
|
| Rubygem | | Elasticsearch |
|
15
14
|
|:-------------:|:-:| :-----------: |
|
@@ -18,7 +17,7 @@ is compatible with the Elasticsearch `master` branch, therefore, with the next m
|
|
18
17
|
| 5.x | → | 5.x |
|
19
18
|
| 6.x | → | 6.x |
|
20
19
|
| 7.x | → | 7.x |
|
21
|
-
| main | → |
|
20
|
+
| main | → | 7.x |
|
22
21
|
|
23
22
|
## Installation
|
24
23
|
|
data/Rakefile
CHANGED
data/elasticsearch-rails.gemspec
CHANGED
@@ -23,8 +23,8 @@ require 'elasticsearch/rails/version'
|
|
23
23
|
Gem::Specification.new do |s|
|
24
24
|
s.name = 'elasticsearch-rails'
|
25
25
|
s.version = Elasticsearch::Rails::VERSION
|
26
|
-
s.authors = ['
|
27
|
-
s.email = ['
|
26
|
+
s.authors = ['Elastic Client Library Maintainers']
|
27
|
+
s.email = ['client-libs@elastic.co']
|
28
28
|
s.description = 'Ruby on Rails integrations for Elasticsearch.'
|
29
29
|
s.summary = 'Ruby on Rails integrations for Elasticsearch.'
|
30
30
|
s.homepage = 'https://github.com/elasticsearch/elasticsearch-rails/'
|
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
45
45
|
s.rdoc_options = ['--charset=UTF-8']
|
46
46
|
|
47
|
-
s.required_ruby_version = '>=
|
47
|
+
s.required_ruby_version = '>= 3'
|
48
48
|
|
49
49
|
s.add_development_dependency 'bundler'
|
50
50
|
s.add_development_dependency 'cane'
|
@@ -57,7 +57,7 @@ namespace :elasticsearch do
|
|
57
57
|
$ rake environment elasticsearch:import:model CLASS='Article' SCOPE='published'
|
58
58
|
DESC
|
59
59
|
desc import_model_desc
|
60
|
-
task :
|
60
|
+
task model: :environment do
|
61
61
|
if ENV['CLASS'].to_s == ''
|
62
62
|
puts '='*90, 'USAGE', '='*90, import_model_desc, ""
|
63
63
|
exit(1)
|
@@ -97,7 +97,7 @@ namespace :elasticsearch do
|
|
97
97
|
|
98
98
|
$ rake environment elasticsearch:import:all DIR=app/models
|
99
99
|
DESC
|
100
|
-
task :
|
100
|
+
task all: :environment do
|
101
101
|
dir = ENV['DIR'].to_s != '' ? ENV['DIR'] : Rails.root.join("app/models")
|
102
102
|
|
103
103
|
puts "[IMPORT] Loading models from: #{dir}"
|
@@ -157,8 +157,8 @@ say_status "Rubygems", "Adding Elasticsearch libraries into Gemfile...\n", :yel
|
|
157
157
|
puts '-'*80, ''; sleep 0.75
|
158
158
|
|
159
159
|
gem 'elasticsearch'
|
160
|
-
gem 'elasticsearch-model', git: 'https://github.com/elasticsearch/elasticsearch-rails.git'
|
161
|
-
gem 'elasticsearch-rails', git: 'https://github.com/elasticsearch/elasticsearch-rails.git'
|
160
|
+
gem 'elasticsearch-model', git: 'https://github.com/elasticsearch/elasticsearch-rails.git', branch: 'main'
|
161
|
+
gem 'elasticsearch-rails', git: 'https://github.com/elasticsearch/elasticsearch-rails.git', branch: 'main'
|
162
162
|
|
163
163
|
|
164
164
|
git add: "Gemfile*"
|
@@ -27,7 +27,7 @@ append_to_file 'README.md', <<-README
|
|
27
27
|
## [4] DSL
|
28
28
|
|
29
29
|
The `dsl` template refactors the search definition in SearchController#index
|
30
|
-
to use the [`elasticsearch-dsl`](https://github.com/elastic/elasticsearch-
|
30
|
+
to use the [`elasticsearch-dsl`](https://github.com/elastic/elasticsearch-dsl-ruby)
|
31
31
|
Rubygem for better expresivity and readability of the code.
|
32
32
|
|
33
33
|
README
|
@@ -44,7 +44,7 @@ puts
|
|
44
44
|
say_status "Rubygems", "Adding Rubygems into Gemfile...\n", :yellow
|
45
45
|
puts '-'*80, ''; sleep 0.25
|
46
46
|
|
47
|
-
gem "elasticsearch-dsl", git: "git://github.com/elastic/elasticsearch-ruby.git"
|
47
|
+
gem "elasticsearch-dsl", git: "git://github.com/elastic/elasticsearch-dsl-ruby.git"
|
48
48
|
|
49
49
|
git add: "Gemfile*"
|
50
50
|
git commit: "-m 'Added the `elasticsearch-dsl` gem'"
|
@@ -37,7 +37,7 @@ class Indexer
|
|
37
37
|
record.__elasticsearch__.client = Client
|
38
38
|
record.__elasticsearch__.__send__ "#{operation}_document"
|
39
39
|
when /delete/
|
40
|
-
Client.delete index: klass.constantize.index_name,
|
40
|
+
Client.delete index: klass.constantize.index_name, id: record_id
|
41
41
|
else raise ArgumentError, "Unknown operation '#{operation}'"
|
42
42
|
end
|
43
43
|
end
|
@@ -18,13 +18,10 @@
|
|
18
18
|
require 'spec_helper'
|
19
19
|
|
20
20
|
describe 'ActiveSupport::Instrumentation integration' do
|
21
|
-
|
22
21
|
before(:all) do
|
23
22
|
class DummyInstrumentationModel
|
24
23
|
extend Elasticsearch::Model::Searching::ClassMethods
|
25
|
-
|
26
|
-
def self.index_name; 'foo'; end
|
27
|
-
def self.document_type; 'bar'; end
|
24
|
+
def self.index_name; 'foo'; end
|
28
25
|
end
|
29
26
|
end
|
30
27
|
|
@@ -33,10 +30,14 @@ describe 'ActiveSupport::Instrumentation integration' do
|
|
33
30
|
end
|
34
31
|
|
35
32
|
let(:response_document) do
|
36
|
-
{
|
37
|
-
'
|
38
|
-
|
39
|
-
|
33
|
+
{
|
34
|
+
'took' => '5ms',
|
35
|
+
'hits' => {
|
36
|
+
'total' => 123,
|
37
|
+
'max_score' => 456,
|
38
|
+
'hits' => []
|
39
|
+
}
|
40
|
+
}
|
40
41
|
end
|
41
42
|
|
42
43
|
let(:search) do
|
@@ -53,7 +54,6 @@ describe 'ActiveSupport::Instrumentation integration' do
|
|
53
54
|
end
|
54
55
|
|
55
56
|
context 'SearchRequest#execute!' do
|
56
|
-
|
57
57
|
it 'wraps the method with instrumentation' do
|
58
58
|
expect(search).to respond_to(:execute_without_instrumentation!)
|
59
59
|
expect(search).to respond_to(:execute_with_instrumentation!)
|
@@ -61,14 +61,19 @@ describe 'ActiveSupport::Instrumentation integration' do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
context 'Model#search' do
|
64
|
-
|
65
64
|
before do
|
66
|
-
expect(ActiveSupport::Notifications).
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
expect(ActiveSupport::Notifications).
|
66
|
+
to receive(:instrument).
|
67
|
+
with('search.elasticsearch',
|
68
|
+
{
|
69
|
+
klass: 'DummyInstrumentationModel',
|
70
|
+
name: 'Search',
|
71
|
+
search: {
|
72
|
+
body: query,
|
73
|
+
index: 'foo',
|
74
|
+
}
|
75
|
+
}
|
76
|
+
).and_return({})
|
72
77
|
end
|
73
78
|
|
74
79
|
let(:query) do
|
data/spec/lograge_spec.rb
CHANGED
@@ -38,14 +38,15 @@ require 'lograge'
|
|
38
38
|
require 'elasticsearch/rails/lograge'
|
39
39
|
|
40
40
|
describe 'ActiveSupport::Instrumentation integration' do
|
41
|
-
|
42
41
|
before do
|
43
42
|
Elasticsearch::Rails::Lograge::Railtie.run_initializers
|
44
43
|
end
|
45
44
|
|
46
45
|
it 'customizes the Lograge configuration' do
|
47
|
-
expect(
|
48
|
-
|
49
|
-
|
46
|
+
expect(
|
47
|
+
Elasticsearch::Rails::Lograge::Railtie.initializers
|
48
|
+
.select { |i| i.name == 'elasticsearch.lograge' }
|
49
|
+
.first
|
50
|
+
).not_to be_nil
|
50
51
|
end
|
51
52
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -36,7 +36,8 @@ RSpec.configure do |config|
|
|
36
36
|
tracer = ::Logger.new(STDERR)
|
37
37
|
tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" }
|
38
38
|
Elasticsearch::Model.client = Elasticsearch::Client.new host: ELASTICSEARCH_URL,
|
39
|
-
tracer: (ENV['QUIET'] ? nil : tracer)
|
39
|
+
tracer: (ENV['QUIET'] ? nil : tracer),
|
40
|
+
transport_options: { :ssl => { verify: false } }
|
40
41
|
puts "Elasticsearch Version: #{Elasticsearch::Model.client.info['version']}"
|
41
42
|
|
42
43
|
unless ActiveRecord::Base.connected?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Elastic Client Library Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -236,7 +236,7 @@ dependencies:
|
|
236
236
|
version: '0'
|
237
237
|
description: Ruby on Rails integrations for Elasticsearch.
|
238
238
|
email:
|
239
|
-
-
|
239
|
+
- client-libs@elastic.co
|
240
240
|
executables: []
|
241
241
|
extensions: []
|
242
242
|
extra_rdoc_files:
|
@@ -295,14 +295,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
295
295
|
requirements:
|
296
296
|
- - ">="
|
297
297
|
- !ruby/object:Gem::Version
|
298
|
-
version: '
|
298
|
+
version: '3'
|
299
299
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
300
300
|
requirements:
|
301
301
|
- - ">="
|
302
302
|
- !ruby/object:Gem::Version
|
303
303
|
version: '0'
|
304
304
|
requirements: []
|
305
|
-
rubygems_version: 3.
|
305
|
+
rubygems_version: 3.5.3
|
306
306
|
signing_key:
|
307
307
|
specification_version: 4
|
308
308
|
summary: Ruby on Rails integrations for Elasticsearch.
|