es-elasticity 0.8.4 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/elasticity/index_config.rb +11 -2
- data/lib/elasticity/version.rb +1 -1
- data/spec/units/document_spec.rb +6 -0
- metadata +37 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e309966bac2144c3c9cb5f0b224558d4bb025cf3
|
4
|
+
data.tar.gz: 67bbe2abe0812300f3481686ee3a3429c387ae26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: befdfdb3ef94fadc1637ef6597092b9a3165051a22a832341bc9de9b02ee2281d835419fb997390202e4514c11573d67ab6b994a2720afd2cb0c32f847bf7e75
|
7
|
+
data.tar.gz: 8fba3aa740454246d3a1f308adf809b5fc804a5c06e97d6d853c8a93d69897341a2797964583eba64f1dc281a5980251d4025ac73b90757ec82eefd926e5f757
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module Elasticity
|
2
2
|
class IndexConfig
|
3
|
-
ATTRS = [
|
3
|
+
ATTRS = [
|
4
|
+
:index_base_name, :document_type, :mapping, :strategy, :subclasses,
|
5
|
+
:settings
|
6
|
+
].freeze
|
4
7
|
VALIDATABLE_ATTRS = [:index_base_name, :document_type, :strategy].freeze
|
5
8
|
|
6
9
|
attr_accessor *ATTRS
|
@@ -26,7 +29,9 @@ module Elasticity
|
|
26
29
|
|
27
30
|
def definition
|
28
31
|
return @definition if defined?(@definition)
|
29
|
-
@definition = {
|
32
|
+
@definition = {
|
33
|
+
settings: merge_settings, mappings: { @document_type => @mapping || {} }
|
34
|
+
}
|
30
35
|
subclasses.each do |doc_type, subclass|
|
31
36
|
@definition[:mappings][doc_type] = subclass.constantize.mapping
|
32
37
|
end if subclasses.present?
|
@@ -60,5 +65,9 @@ module Elasticity
|
|
60
65
|
raise "#{attr} is not set" if public_send(attr).nil?
|
61
66
|
end
|
62
67
|
end
|
68
|
+
|
69
|
+
def merge_settings
|
70
|
+
@elasticity_config.settings.merge(settings || {})
|
71
|
+
end
|
63
72
|
end
|
64
73
|
end
|
data/lib/elasticity/version.rb
CHANGED
data/spec/units/document_spec.rb
CHANGED
@@ -24,6 +24,7 @@ RSpec.describe Elasticity::Document do
|
|
24
24
|
c.index_base_name = "class_names"
|
25
25
|
c.document_type = "class_name"
|
26
26
|
c.mapping = mappings
|
27
|
+
c.settings = { number_of_shards: 2 }
|
27
28
|
end
|
28
29
|
|
29
30
|
attr_accessor :name, :items
|
@@ -53,5 +54,10 @@ RSpec.describe Elasticity::Document do
|
|
53
54
|
expect(strategy).to receive(:index_document).with("class_name", 1, { name: "Foo", items: [{ name: "Item1" }] }).and_return("_id" => "1", "created" => true)
|
54
55
|
subject.update
|
55
56
|
end
|
57
|
+
|
58
|
+
it "assigns number_of_shards if present" do
|
59
|
+
expect(subject.config.settings[:number_of_shards]).to eq 2
|
60
|
+
expect(subject.config.definition[:settings][:number_of_shards]).to eq 2
|
61
|
+
end
|
56
62
|
end
|
57
63
|
end
|
metadata
CHANGED
@@ -1,193 +1,193 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: es-elasticity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Kochenburger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 3.1.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 3.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.7.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.7.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: oj
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: byebug
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: codeclimate-test-reporter
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: redis
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: activesupport
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: 4.0.0
|
146
|
-
- - <
|
146
|
+
- - "<"
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '6'
|
149
149
|
type: :runtime
|
150
150
|
prerelease: false
|
151
151
|
version_requirements: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- -
|
153
|
+
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: 4.0.0
|
156
|
-
- - <
|
156
|
+
- - "<"
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '6'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: activemodel
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
|
-
- -
|
163
|
+
- - ">="
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: 4.0.0
|
166
|
-
- - <
|
166
|
+
- - "<"
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '6'
|
169
169
|
type: :runtime
|
170
170
|
prerelease: false
|
171
171
|
version_requirements: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
|
-
- -
|
173
|
+
- - ">="
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: 4.0.0
|
176
|
-
- - <
|
176
|
+
- - "<"
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: '6'
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: elasticsearch
|
181
181
|
requirement: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
|
-
- -
|
183
|
+
- - ">="
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '1.0'
|
186
186
|
type: :runtime
|
187
187
|
prerelease: false
|
188
188
|
version_requirements: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
|
-
- -
|
190
|
+
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: '1.0'
|
193
193
|
description: Elasticity provides a higher level abstraction on top of [elasticsearch-ruby](https://github.com/elasticsearch/elasticsearch-ruby)
|
@@ -198,10 +198,10 @@ executables: []
|
|
198
198
|
extensions: []
|
199
199
|
extra_rdoc_files: []
|
200
200
|
files:
|
201
|
-
- .gitignore
|
202
|
-
- .rspec
|
203
|
-
- .simplecov
|
204
|
-
- .travis.yml
|
201
|
+
- ".gitignore"
|
202
|
+
- ".rspec"
|
203
|
+
- ".simplecov"
|
204
|
+
- ".travis.yml"
|
205
205
|
- CHANGELOG
|
206
206
|
- CONTRIBUTING.md
|
207
207
|
- Gemfile
|
@@ -250,17 +250,17 @@ require_paths:
|
|
250
250
|
- lib
|
251
251
|
required_ruby_version: !ruby/object:Gem::Requirement
|
252
252
|
requirements:
|
253
|
-
- -
|
253
|
+
- - ">="
|
254
254
|
- !ruby/object:Gem::Version
|
255
255
|
version: '0'
|
256
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
257
|
requirements:
|
258
|
-
- -
|
258
|
+
- - ">="
|
259
259
|
- !ruby/object:Gem::Version
|
260
260
|
version: '0'
|
261
261
|
requirements: []
|
262
262
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.
|
263
|
+
rubygems_version: 2.6.13
|
264
264
|
signing_key:
|
265
265
|
specification_version: 4
|
266
266
|
summary: ActiveModel-based library for working with Elasticsearch
|