wj-mongoid-elasticsearch 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +97 -80
- data/lib/mongoid/elasticsearch.rb +8 -2
- data/lib/mongoid/elasticsearch/es.rb +16 -2
- data/lib/mongoid/elasticsearch/version.rb +1 -1
- data/mongoid-elasticsearch.gemspec +3 -1
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 578a2f4897aa691d5e5be10fe7101e434b566795
|
4
|
+
data.tar.gz: 37be0ba588cc85d59df49e520bcee7c34640f18e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06026e6ea7f345909c325e3b671cc6236304154715295ba680141f32169a0446d990f889bdfe3d52c61e46bb3e65cd14436395833129f28caca8d72fe58fb0b
|
7
|
+
data.tar.gz: adbf2fa97b6f63a9c2d2218e3a7ab1621609ba148f0070b5faefdffbca7cca3a561f1bbc4d6646cb3a0936c97a31765cd9c0c151431d640b8e1bdb59ad444594
|
data/Gemfile.lock
CHANGED
@@ -1,133 +1,150 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/DatabaseCleaner/database_cleaner.git
|
3
|
-
revision:
|
3
|
+
revision: b393fa81fc864805e79913f4377e316be40f8900
|
4
4
|
specs:
|
5
|
-
database_cleaner (1.
|
5
|
+
database_cleaner (1.6.3)
|
6
6
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
mongoid-elasticsearch (0.
|
10
|
+
wj-mongoid-elasticsearch (0.0.2)
|
11
11
|
elasticsearch (~> 1.0.13)
|
12
|
+
faraday_middleware
|
13
|
+
faraday_middleware-aws-sigv4
|
12
14
|
mongoid (>= 3.0, < 6.0)
|
15
|
+
patron
|
13
16
|
ruby-progressbar
|
14
17
|
|
15
18
|
GEM
|
16
19
|
remote: https://rubygems.org/
|
17
20
|
specs:
|
18
|
-
|
19
|
-
|
20
|
-
activesupport (= 4.2.6)
|
21
|
-
rack (~> 1.6)
|
22
|
-
rack-test (~> 0.6.2)
|
23
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
24
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
25
|
-
actionview (4.2.6)
|
26
|
-
activesupport (= 4.2.6)
|
21
|
+
actionview (4.2.10)
|
22
|
+
activesupport (= 4.2.10)
|
27
23
|
builder (~> 3.1)
|
28
24
|
erubis (~> 2.7.0)
|
29
25
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
30
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
31
|
-
activemodel (4.2.
|
32
|
-
activesupport (= 4.2.
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
27
|
+
activemodel (4.2.10)
|
28
|
+
activesupport (= 4.2.10)
|
33
29
|
builder (~> 3.1)
|
34
|
-
|
30
|
+
activerecord (4.2.10)
|
31
|
+
activemodel (= 4.2.10)
|
32
|
+
activesupport (= 4.2.10)
|
33
|
+
arel (~> 6.0)
|
34
|
+
activesupport (4.2.10)
|
35
35
|
i18n (~> 0.7)
|
36
|
-
json (~> 1.7, >= 1.7.7)
|
37
36
|
minitest (~> 5.1)
|
38
37
|
thread_safe (~> 0.3, >= 0.3.4)
|
39
38
|
tzinfo (~> 1.1)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
arel (6.0.4)
|
40
|
+
aws-sigv4 (1.0.2)
|
41
|
+
bson (4.3.0)
|
42
|
+
builder (3.2.3)
|
43
|
+
concurrent-ruby (1.0.5)
|
44
|
+
coveralls (0.8.21)
|
45
|
+
json (>= 1.8, < 3)
|
46
|
+
simplecov (~> 0.14.1)
|
45
47
|
term-ansicolor (~> 1.3)
|
46
|
-
thor (~> 0.19.
|
47
|
-
tins (~> 1.6
|
48
|
-
|
48
|
+
thor (~> 0.19.4)
|
49
|
+
tins (~> 1.6)
|
50
|
+
crass (1.0.3)
|
51
|
+
diff-lcs (1.3)
|
49
52
|
docile (1.1.5)
|
50
|
-
elasticsearch (1.0.
|
51
|
-
elasticsearch-api (= 1.0.
|
52
|
-
elasticsearch-transport (= 1.0.
|
53
|
-
elasticsearch-api (1.0.
|
53
|
+
elasticsearch (1.0.18)
|
54
|
+
elasticsearch-api (= 1.0.18)
|
55
|
+
elasticsearch-transport (= 1.0.18)
|
56
|
+
elasticsearch-api (1.0.18)
|
54
57
|
multi_json
|
55
|
-
elasticsearch-transport (1.0.
|
58
|
+
elasticsearch-transport (1.0.18)
|
56
59
|
faraday
|
57
60
|
multi_json
|
58
61
|
erubis (2.7.0)
|
59
|
-
faraday (0.
|
62
|
+
faraday (0.14.0)
|
60
63
|
multipart-post (>= 1.2, < 3)
|
64
|
+
faraday_middleware (0.12.2)
|
65
|
+
faraday (>= 0.7.4, < 1.0)
|
66
|
+
faraday_middleware-aws-sigv4 (0.2.4)
|
67
|
+
aws-sigv4 (~> 1.0)
|
68
|
+
faraday (>= 0.9)
|
61
69
|
glebtv-httpclient (3.2.8)
|
62
70
|
lru_redux
|
63
|
-
hashie (3.
|
64
|
-
i18n (0.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
activesupport (>=
|
69
|
-
|
71
|
+
hashie (3.5.7)
|
72
|
+
i18n (0.9.5)
|
73
|
+
concurrent-ruby (~> 1.0)
|
74
|
+
json (2.1.0)
|
75
|
+
kaminari (1.1.1)
|
76
|
+
activesupport (>= 4.1.0)
|
77
|
+
kaminari-actionview (= 1.1.1)
|
78
|
+
kaminari-activerecord (= 1.1.1)
|
79
|
+
kaminari-core (= 1.1.1)
|
80
|
+
kaminari-actionview (1.1.1)
|
81
|
+
actionview
|
82
|
+
kaminari-core (= 1.1.1)
|
83
|
+
kaminari-activerecord (1.1.1)
|
84
|
+
activerecord
|
85
|
+
kaminari-core (= 1.1.1)
|
86
|
+
kaminari-core (1.1.1)
|
87
|
+
loofah (2.2.0)
|
88
|
+
crass (~> 1.0.2)
|
70
89
|
nokogiri (>= 1.5.9)
|
71
90
|
lru_redux (1.1.0)
|
72
|
-
mini_portile2 (2.
|
73
|
-
minitest (5.
|
74
|
-
mongo (2.
|
75
|
-
bson (
|
76
|
-
mongoid (5.1
|
91
|
+
mini_portile2 (2.3.0)
|
92
|
+
minitest (5.11.3)
|
93
|
+
mongo (2.5.1)
|
94
|
+
bson (>= 4.3.0, < 5.0.0)
|
95
|
+
mongoid (5.2.1)
|
77
96
|
activemodel (~> 4.0)
|
78
|
-
mongo (
|
79
|
-
origin (~> 2.
|
97
|
+
mongo (>= 2.4.1, < 3.0.0)
|
98
|
+
origin (~> 2.3)
|
80
99
|
tzinfo (>= 0.3.37)
|
81
|
-
mongoid-compatibility (0.
|
100
|
+
mongoid-compatibility (0.5.1)
|
82
101
|
activesupport
|
83
102
|
mongoid (>= 2.0)
|
84
103
|
mongoid-slug (5.0.0)
|
85
104
|
mongoid (>= 3.0)
|
86
105
|
mongoid-compatibility
|
87
106
|
stringex (~> 2.0)
|
88
|
-
multi_json (1.
|
107
|
+
multi_json (1.13.1)
|
89
108
|
multipart-post (2.0.0)
|
90
|
-
nokogiri (1.
|
91
|
-
mini_portile2 (~> 2.
|
92
|
-
origin (2.
|
93
|
-
|
94
|
-
rack-test (0.6.3)
|
95
|
-
rack (>= 1.0)
|
109
|
+
nokogiri (1.8.2)
|
110
|
+
mini_portile2 (~> 2.3.0)
|
111
|
+
origin (2.3.1)
|
112
|
+
patron (0.12.1)
|
96
113
|
rails-deprecated_sanitizer (1.0.3)
|
97
114
|
activesupport (>= 4.2.0.alpha)
|
98
|
-
rails-dom-testing (1.0.
|
99
|
-
activesupport (>= 4.2.0
|
100
|
-
nokogiri (~> 1.6
|
115
|
+
rails-dom-testing (1.0.9)
|
116
|
+
activesupport (>= 4.2.0, < 5.0)
|
117
|
+
nokogiri (~> 1.6)
|
101
118
|
rails-deprecated_sanitizer (>= 1.0.1)
|
102
119
|
rails-html-sanitizer (1.0.3)
|
103
120
|
loofah (~> 2.0)
|
104
|
-
rake (
|
105
|
-
rspec (3.
|
106
|
-
rspec-core (~> 3.
|
107
|
-
rspec-expectations (~> 3.
|
108
|
-
rspec-mocks (~> 3.
|
109
|
-
rspec-core (3.
|
110
|
-
rspec-support (~> 3.
|
111
|
-
rspec-expectations (3.
|
121
|
+
rake (12.3.0)
|
122
|
+
rspec (3.7.0)
|
123
|
+
rspec-core (~> 3.7.0)
|
124
|
+
rspec-expectations (~> 3.7.0)
|
125
|
+
rspec-mocks (~> 3.7.0)
|
126
|
+
rspec-core (3.7.1)
|
127
|
+
rspec-support (~> 3.7.0)
|
128
|
+
rspec-expectations (3.7.0)
|
112
129
|
diff-lcs (>= 1.2.0, < 2.0)
|
113
|
-
rspec-support (~> 3.
|
114
|
-
rspec-mocks (3.
|
130
|
+
rspec-support (~> 3.7.0)
|
131
|
+
rspec-mocks (3.7.0)
|
115
132
|
diff-lcs (>= 1.2.0, < 2.0)
|
116
|
-
rspec-support (~> 3.
|
117
|
-
rspec-support (3.
|
118
|
-
ruby-progressbar (1.
|
119
|
-
simplecov (0.
|
133
|
+
rspec-support (~> 3.7.0)
|
134
|
+
rspec-support (3.7.1)
|
135
|
+
ruby-progressbar (1.9.0)
|
136
|
+
simplecov (0.14.1)
|
120
137
|
docile (~> 1.1.0)
|
121
|
-
json (
|
138
|
+
json (>= 1.8, < 3)
|
122
139
|
simplecov-html (~> 0.10.0)
|
123
|
-
simplecov-html (0.10.
|
124
|
-
stringex (2.
|
125
|
-
term-ansicolor (1.
|
140
|
+
simplecov-html (0.10.2)
|
141
|
+
stringex (2.8.2)
|
142
|
+
term-ansicolor (1.6.0)
|
126
143
|
tins (~> 1.0)
|
127
|
-
thor (0.19.
|
128
|
-
thread_safe (0.3.
|
129
|
-
tins (1.
|
130
|
-
tzinfo (1.2.
|
144
|
+
thor (0.19.4)
|
145
|
+
thread_safe (0.3.6)
|
146
|
+
tins (1.16.3)
|
147
|
+
tzinfo (1.2.5)
|
131
148
|
thread_safe (~> 0.1)
|
132
149
|
|
133
150
|
PLATFORMS
|
@@ -140,10 +157,10 @@ DEPENDENCIES
|
|
140
157
|
glebtv-httpclient
|
141
158
|
hashie
|
142
159
|
kaminari
|
143
|
-
mongoid-elasticsearch!
|
144
160
|
mongoid-slug (~> 5.0.0)
|
145
161
|
rake
|
146
162
|
rspec
|
163
|
+
wj-mongoid-elasticsearch!
|
147
164
|
|
148
165
|
BUNDLED WITH
|
149
|
-
1.
|
166
|
+
1.13.7
|
@@ -23,6 +23,9 @@ module Mongoid
|
|
23
23
|
mattr_accessor :client_options
|
24
24
|
self.client_options = {}
|
25
25
|
|
26
|
+
mattr_accessor :create_aws_client
|
27
|
+
self.create_aws_client = false
|
28
|
+
|
26
29
|
mattr_accessor :registered_indexes
|
27
30
|
self.registered_indexes = []
|
28
31
|
|
@@ -51,6 +54,7 @@ module Mongoid
|
|
51
54
|
prefix_name: true,
|
52
55
|
index_name: nil,
|
53
56
|
client_options: {},
|
57
|
+
create_aws_client: false,
|
54
58
|
index_options: {},
|
55
59
|
index_mappings: nil,
|
56
60
|
wrapper: :model,
|
@@ -62,11 +66,12 @@ module Mongoid
|
|
62
66
|
attr_accessor :_type, :_score, :_source
|
63
67
|
end
|
64
68
|
|
65
|
-
cattr_accessor :es_client_options, :es_index_name, :es_index_options, :es_wrapper, :es_skip_create
|
69
|
+
cattr_accessor :es_client_options, :es_index_name, :es_index_options, :es_wrapper, :es_skip_create, :es_create_aws_client
|
66
70
|
|
67
71
|
self.es_client_options = Mongoid::Elasticsearch.client_options.dup.merge(options[:client_options])
|
68
72
|
self.es_index_name = (options[:prefix_name] ? Mongoid::Elasticsearch.prefix : '') + (options[:index_name] || model_name.plural)
|
69
73
|
self.es_index_options = options[:index_options]
|
74
|
+
self.es_create_aws_client = options[:create_aws_client]
|
70
75
|
self.es_wrapper = options[:wrapper]
|
71
76
|
self.es_skip_create = options[:skip_create]
|
72
77
|
|
@@ -106,8 +111,9 @@ module Mongoid
|
|
106
111
|
end
|
107
112
|
# use `_all` or empty string to perform the operation on all indices
|
108
113
|
# regardless whether they are managed by Mongoid::Elasticsearch or not
|
114
|
+
## removed ignore_missing since it is not compatible with elasticsearch 6.2.3
|
109
115
|
unless query.key?(:index)
|
110
|
-
query.merge!(index: Mongoid::Elasticsearch.registered_indexes.join(','),
|
116
|
+
query.merge!(index: Mongoid::Elasticsearch.registered_indexes.join(','), ignore_unavailable: true)
|
111
117
|
end
|
112
118
|
|
113
119
|
page = options[:page]
|
@@ -1,3 +1,7 @@
|
|
1
|
+
require 'patron'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
require 'faraday_middleware/aws_sigv4'
|
4
|
+
|
1
5
|
module Mongoid
|
2
6
|
module Elasticsearch
|
3
7
|
class Es
|
@@ -10,8 +14,18 @@ module Mongoid
|
|
10
14
|
end
|
11
15
|
|
12
16
|
def client
|
13
|
-
|
14
|
-
|
17
|
+
if klass.es_create_aws_client
|
18
|
+
@client ||= ::Elasticsearch::Client.new(host: ENV["AWS_ES_HOST"], port: ENV["AWS_ES_PORT"]) do |f|
|
19
|
+
f.request :aws_sigv4,
|
20
|
+
credentials: Aws::Credentials.new(ENV["AWS_KEY"],ENV["AWS_SECRET"]),
|
21
|
+
service: ENV["AWS_ES_SERVICE"],
|
22
|
+
region: ENV["AWS_ES_REGION"]
|
23
|
+
f.response :logger
|
24
|
+
f.adapter Faraday.default_adapter
|
25
|
+
end
|
26
|
+
else
|
27
|
+
@client ||= ::Elasticsearch::Client.new klass.es_client_options.dup
|
28
|
+
end
|
15
29
|
end
|
16
30
|
|
17
31
|
def index
|
@@ -21,7 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency "mongoid", [">= 3.0", "< 6.0"]
|
22
22
|
spec.add_dependency "elasticsearch", "~> 1.0.13"
|
23
23
|
spec.add_dependency "ruby-progressbar"
|
24
|
-
|
24
|
+
spec.add_dependency 'faraday_middleware'
|
25
|
+
spec.add_dependency 'faraday_middleware-aws-sigv4'
|
26
|
+
spec.add_dependency 'patron'
|
25
27
|
spec.add_development_dependency "bundler"
|
26
28
|
spec.add_development_dependency "rake"
|
27
29
|
spec.add_development_dependency "rspec"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wj-mongoid-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebtv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -58,6 +58,48 @@ dependencies:
|
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: faraday_middleware
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: faraday_middleware-aws-sigv4
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: patron
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
61
103
|
- !ruby/object:Gem::Dependency
|
62
104
|
name: bundler
|
63
105
|
requirement: !ruby/object:Gem::Requirement
|