chewy 0.10.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +25 -25
- data/.travis.yml +21 -29
- data/Appraisals +27 -9
- data/CHANGELOG.md +36 -0
- data/Gemfile +3 -1
- data/README.md +73 -23
- data/chewy.gemspec +6 -8
- data/gemfiles/rails.4.0.activerecord.gemfile +1 -0
- data/gemfiles/rails.4.1.activerecord.gemfile +1 -0
- data/gemfiles/rails.4.2.activerecord.gemfile +1 -0
- data/gemfiles/{rails.4.2.mongoid.5.1.gemfile → rails.4.2.mongoid.5.2.gemfile} +2 -1
- data/gemfiles/rails.5.0.activerecord.gemfile +2 -1
- data/gemfiles/{rails.5.0.mongoid.6.0.gemfile → rails.5.0.mongoid.6.1.gemfile} +3 -2
- data/gemfiles/rails.5.1.activerecord.gemfile +2 -1
- data/gemfiles/{rails.5.1.mongoid.6.1.gemfile → rails.5.1.mongoid.6.3.gemfile} +3 -2
- data/gemfiles/rails.5.2.activerecord.gemfile +16 -0
- data/gemfiles/sequel.4.45.gemfile +2 -2
- data/lib/chewy.rb +1 -0
- data/lib/chewy/config.rb +8 -19
- data/lib/chewy/fields/base.rb +15 -3
- data/lib/chewy/fields/root.rb +13 -9
- data/lib/chewy/index.rb +1 -1
- data/lib/chewy/index/actions.rb +14 -12
- data/lib/chewy/index/settings.rb +2 -0
- data/lib/chewy/index/specification.rb +12 -10
- data/lib/chewy/minitest/helpers.rb +6 -6
- data/lib/chewy/minitest/search_index_receiver.rb +17 -17
- data/lib/chewy/query.rb +135 -96
- data/lib/chewy/query/filters.rb +20 -3
- data/lib/chewy/query/loading.rb +0 -1
- data/lib/chewy/railtie.rb +2 -4
- data/lib/chewy/rake_helper.rb +5 -5
- data/lib/chewy/rspec/update_index.rb +3 -5
- data/lib/chewy/search.rb +2 -2
- data/lib/chewy/search/parameters/concerns/query_storage.rb +4 -3
- data/lib/chewy/stash.rb +30 -21
- data/lib/chewy/strategy/atomic.rb +1 -1
- data/lib/chewy/type.rb +2 -2
- data/lib/chewy/type/adapter/base.rb +9 -9
- data/lib/chewy/type/adapter/mongoid.rb +1 -3
- data/lib/chewy/type/adapter/sequel.rb +4 -6
- data/lib/chewy/type/crutch.rb +1 -1
- data/lib/chewy/type/import.rb +3 -2
- data/lib/chewy/type/import/bulk_builder.rb +1 -1
- data/lib/chewy/type/import/journal_builder.rb +3 -3
- data/lib/chewy/type/import/routine.rb +2 -2
- data/lib/chewy/type/mapping.rb +40 -34
- data/lib/chewy/type/observe.rb +13 -9
- data/lib/chewy/type/syncer.rb +2 -2
- data/lib/chewy/type/witchcraft.rb +2 -2
- data/lib/chewy/type/wrapper.rb +2 -2
- data/lib/chewy/version.rb +1 -1
- data/lib/sequel/plugins/chewy_observe.rb +4 -19
- data/spec/chewy/config_spec.rb +16 -0
- data/spec/chewy/fields/base_spec.rb +61 -65
- data/spec/chewy/fields/root_spec.rb +13 -13
- data/spec/chewy/index/actions_spec.rb +37 -5
- data/spec/chewy/index/specification_spec.rb +25 -16
- data/spec/chewy/index_spec.rb +61 -8
- data/spec/chewy/journal_spec.rb +11 -11
- data/spec/chewy/query/filters_spec.rb +1 -1
- data/spec/chewy/query/nodes/not_spec.rb +1 -0
- data/spec/chewy/query_spec.rb +3 -2
- data/spec/chewy/rake_helper_spec.rb +46 -33
- data/spec/chewy/search_spec.rb +20 -10
- data/spec/chewy/stash_spec.rb +1 -1
- data/spec/chewy/strategy/shoryuken_spec.rb +2 -0
- data/spec/chewy/type/import/journal_builder_spec.rb +8 -8
- data/spec/chewy/type/import_spec.rb +6 -0
- data/spec/chewy/type/mapping_spec.rb +48 -17
- data/spec/spec_helper.rb +8 -0
- metadata +26 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2decd9fc56f1c1116f0470c5dfce2fb84b3dbbab25ed42bcc1813f2f91069292
|
4
|
+
data.tar.gz: 969f6d74cff1f399ffa9752d2559a9affcaa2fe96a63e05cdfe4aa2b0add0af4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e55c97184ed6f171f9383087b792b6261167687acad1add6ca2d5196e87676b1600c54277174e213fd07de6d6d811124a20130ac7ca7ccb5b7077a78a710fbbc
|
7
|
+
data.tar.gz: b0ceb62da09eea3332e1d67bdca2ab56dfadae6366ca27a8009e502da01057891e7c6a33bfb67f81f4b35119eff550b4390d40e9860e2441065d72c4d30fca78
|
data/.rubocop.yml
CHANGED
@@ -1,50 +1,50 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
-
|
4
|
-
Enabled: false
|
5
|
-
|
6
|
-
Lint/EndAlignment:
|
7
|
-
EnforcedStyleAlignWith: variable
|
8
|
-
|
9
|
-
Style/AccessModifierIndentation:
|
3
|
+
Layout/AccessModifierIndentation:
|
10
4
|
EnforcedStyle: outdent
|
11
5
|
|
12
|
-
|
13
|
-
EnforcedStyle: prefer_alias_method
|
14
|
-
|
15
|
-
Style/AlignHash:
|
6
|
+
Layout/AlignHash:
|
16
7
|
EnforcedLastArgumentHashStyle: always_ignore
|
17
8
|
|
18
|
-
|
9
|
+
Layout/AlignParameters:
|
19
10
|
EnforcedStyle: with_fixed_indentation
|
20
11
|
|
21
|
-
|
22
|
-
EnforcedStyle: conditionals
|
23
|
-
|
24
|
-
Style/CaseIndentation:
|
12
|
+
Layout/CaseIndentation:
|
25
13
|
EnforcedStyle: end
|
26
14
|
|
27
|
-
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
Style/IndentArray:
|
15
|
+
Layout/IndentArray:
|
31
16
|
EnforcedStyle: consistent
|
32
17
|
|
33
|
-
|
18
|
+
Layout/IndentHash:
|
34
19
|
EnforcedStyle: consistent
|
35
20
|
|
36
|
-
|
21
|
+
Layout/IndentHeredoc:
|
37
22
|
Enabled: false
|
38
23
|
|
39
|
-
|
24
|
+
Layout/MultilineMethodCallIndentation:
|
40
25
|
EnforcedStyle: indented
|
41
26
|
|
42
|
-
|
27
|
+
Layout/MultilineOperationIndentation:
|
43
28
|
EnforcedStyle: indented
|
44
29
|
|
45
|
-
|
30
|
+
Layout/SpaceInsideHashLiteralBraces:
|
46
31
|
EnforcedStyle: no_space
|
47
32
|
|
33
|
+
Lint/AmbiguousBlockAssociation:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Lint/EndAlignment:
|
37
|
+
EnforcedStyleAlignWith: variable
|
38
|
+
|
39
|
+
Style/Alias:
|
40
|
+
EnforcedStyle: prefer_alias_method
|
41
|
+
|
42
|
+
Style/AndOr:
|
43
|
+
EnforcedStyle: conditionals
|
44
|
+
|
45
|
+
Style/DoubleNegation:
|
46
|
+
Enabled: false
|
47
|
+
|
48
48
|
Metrics/BlockLength:
|
49
49
|
Exclude:
|
50
50
|
- '**/*_spec.rb'
|
data/.travis.yml
CHANGED
@@ -5,48 +5,40 @@ services:
|
|
5
5
|
jdk:
|
6
6
|
- oraclejdk8
|
7
7
|
rvm:
|
8
|
-
- 2.
|
9
|
-
- 2.3.4
|
10
|
-
- 2.4.1
|
8
|
+
- 2.4.3
|
11
9
|
env:
|
12
10
|
global:
|
13
11
|
- TEST_CLUSTER_NODES=1
|
14
12
|
matrix:
|
15
|
-
- ES_VERSION=
|
16
|
-
- ES_VERSION=5.4.0
|
13
|
+
- ES_VERSION=5.6.7
|
17
14
|
gemfile:
|
18
|
-
- gemfiles/rails.4.0.activerecord.gemfile
|
19
|
-
- gemfiles/rails.4.1.activerecord.gemfile
|
20
|
-
- gemfiles/rails.4.2.activerecord.gemfile
|
21
15
|
- gemfiles/rails.5.0.activerecord.gemfile
|
22
16
|
- gemfiles/rails.5.1.activerecord.gemfile
|
23
|
-
- gemfiles/rails.
|
24
|
-
- gemfiles/rails.5.
|
25
|
-
- gemfiles/rails.5.1.mongoid.6.1.gemfile
|
17
|
+
- gemfiles/rails.5.0.mongoid.6.1.gemfile
|
18
|
+
- gemfiles/rails.5.1.mongoid.6.3.gemfile
|
26
19
|
- gemfiles/sequel.4.45.gemfile
|
27
20
|
matrix:
|
28
|
-
|
29
|
-
- rvm: 2.2.
|
30
|
-
env: ES_VERSION=5.4.0
|
31
|
-
- rvm: 2.3.4
|
32
|
-
env: ES_VERSION=2.4.4
|
33
|
-
- gemfile: gemfiles/rails.4.0.activerecord.gemfile
|
34
|
-
env: ES_VERSION=5.4.0
|
35
|
-
- gemfile: gemfiles/rails.4.1.activerecord.gemfile
|
36
|
-
env: ES_VERSION=5.4.0
|
37
|
-
- gemfile: gemfiles/rails.4.2.mongoid.5.1.gemfile
|
38
|
-
env: ES_VERSION=5.4.0
|
39
|
-
- gemfile: gemfiles/rails.5.1.mongoid.6.0.gemfile
|
40
|
-
env: ES_VERSION=5.4.0
|
41
|
-
- rvm: 2.4.1
|
21
|
+
include:
|
22
|
+
- rvm: 2.2.9
|
42
23
|
gemfile: gemfiles/rails.4.0.activerecord.gemfile
|
43
|
-
|
24
|
+
env: ES_VERSION=2.4.6
|
25
|
+
- rvm: 2.2.9
|
44
26
|
gemfile: gemfiles/rails.4.1.activerecord.gemfile
|
27
|
+
env: ES_VERSION=2.4.6
|
28
|
+
- rvm: 2.3.6
|
29
|
+
gemfile: gemfiles/rails.4.2.activerecord.gemfile
|
30
|
+
env: ES_VERSION=2.4.6
|
31
|
+
- rvm: 2.3.6
|
32
|
+
gemfile: gemfiles/rails.4.2.mongoid.5.2.gemfile
|
33
|
+
env: ES_VERSION=2.4.6
|
34
|
+
- rvm: 2.5.0
|
35
|
+
gemfile: gemfiles/rails.5.2.activerecord.gemfile
|
36
|
+
env: ES_VERSION=5.6.7
|
45
37
|
before_install:
|
46
|
-
- curl -s https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.
|
47
|
-
- curl -s https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.
|
38
|
+
- curl -s https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.6/elasticsearch-2.4.6.tar.gz | tar xz -C /tmp
|
39
|
+
- curl -s https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.7.tar.gz | tar xz -C /tmp
|
48
40
|
before_script:
|
49
|
-
- /tmp/elasticsearch-2.4.
|
41
|
+
- /tmp/elasticsearch-2.4.6/bin/plugin install delete-by-query
|
50
42
|
- TEST_CLUSTER_COMMAND=/tmp/elasticsearch-$ES_VERSION/bin/elasticsearch TEST_CLUSTER_LOGS=/tmp/log rake es:start
|
51
43
|
script:
|
52
44
|
- bundle exec rspec
|
data/Appraisals
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# rubocop:disable Style/FileName
|
2
|
-
|
3
1
|
%w[4.0 4.1 4.2].each do |activesupport|
|
4
2
|
appraise "rails.#{activesupport}.activerecord" do
|
5
3
|
gem 'activerecord', "~> #{activesupport}.0"
|
@@ -8,6 +6,7 @@
|
|
8
6
|
gem 'activejob', "~> #{activesupport}.0" if activesupport >= '4.2'
|
9
7
|
gem 'resque', require: false
|
10
8
|
gem 'shoryuken', require: false
|
9
|
+
gem 'aws-sdk-sqs', require: false
|
11
10
|
gem 'sidekiq', require: false
|
12
11
|
|
13
12
|
gem 'kaminari', '~> 0.17.0', require: false
|
@@ -25,22 +24,40 @@ end
|
|
25
24
|
gem 'activejob', "~> #{activesupport}.0"
|
26
25
|
gem 'resque', require: false
|
27
26
|
gem 'shoryuken', require: false
|
27
|
+
gem 'aws-sdk-sqs', require: false
|
28
28
|
gem 'sidekiq', require: false
|
29
29
|
|
30
|
-
gem 'kaminari-core', '~> 1.
|
30
|
+
gem 'kaminari-core', '~> 1.1.0', require: false
|
31
31
|
gem 'will_paginate', require: false
|
32
32
|
|
33
33
|
gem 'parallel', require: false
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
appraise 'rails.
|
38
|
-
gem '
|
37
|
+
appraise 'rails.5.2.activerecord' do
|
38
|
+
gem 'activerecord', '~> 5.2.0.rc1'
|
39
|
+
gem 'activesupport', '~> 5.2.0.rc1'
|
40
|
+
|
41
|
+
gem 'activejob', '~> 5.2.0.rc1'
|
42
|
+
gem 'resque', require: false
|
43
|
+
gem 'shoryuken', require: false
|
44
|
+
gem 'aws-sdk-sqs', require: false
|
45
|
+
gem 'sidekiq', require: false
|
46
|
+
|
47
|
+
gem 'kaminari-core', '~> 1.1.0', require: false
|
48
|
+
gem 'will_paginate', require: false
|
49
|
+
|
50
|
+
gem 'parallel', require: false
|
51
|
+
end
|
52
|
+
|
53
|
+
appraise 'rails.4.2.mongoid.5.2' do
|
54
|
+
gem 'mongoid', '~> 5.2.0'
|
39
55
|
gem 'activesupport', '~> 4.2.0'
|
40
56
|
|
41
57
|
gem 'activejob', '~> 4.2.0'
|
42
58
|
gem 'resque', require: false
|
43
59
|
gem 'shoryuken', require: false
|
60
|
+
gem 'aws-sdk-sqs', require: false
|
44
61
|
gem 'sidekiq', require: false
|
45
62
|
|
46
63
|
gem 'kaminari', '~> 0.17.0', require: false
|
@@ -49,7 +66,7 @@ appraise 'rails.4.2.mongoid.5.1' do
|
|
49
66
|
gem 'parallel', require: false
|
50
67
|
end
|
51
68
|
|
52
|
-
{'5.0' => '6.
|
69
|
+
{'5.0' => '6.1', '5.1' => '6.3'}.each do |activesupport, mongoid|
|
53
70
|
appraise "rails.#{activesupport}.mongoid.#{mongoid}" do
|
54
71
|
gem 'mongoid', "~> #{mongoid}.0"
|
55
72
|
gem 'activesupport', "~> #{activesupport}.0"
|
@@ -57,9 +74,10 @@ end
|
|
57
74
|
gem 'activejob', "~> #{activesupport}.0"
|
58
75
|
gem 'resque', require: false
|
59
76
|
gem 'shoryuken', require: false
|
77
|
+
gem 'aws-sdk-sqs', require: false
|
60
78
|
gem 'sidekiq', require: false
|
61
79
|
|
62
|
-
gem 'kaminari-core', '~> 1.
|
80
|
+
gem 'kaminari-core', '~> 1.1.0', require: false
|
63
81
|
gem 'will_paginate', require: false
|
64
82
|
|
65
83
|
gem 'parallel', require: false
|
@@ -69,9 +87,9 @@ end
|
|
69
87
|
%w[4.45].each do |sequel|
|
70
88
|
appraise "sequel.#{sequel}" do
|
71
89
|
gem 'sequel', "~> #{sequel}.0"
|
72
|
-
gem 'activesupport', '~> 5.
|
90
|
+
gem 'activesupport', '~> 5.1.0'
|
73
91
|
|
74
|
-
gem 'kaminari-core', '~> 1.
|
92
|
+
gem 'kaminari-core', '~> 1.1.0', require: false
|
75
93
|
gem 'will_paginate', require: false
|
76
94
|
|
77
95
|
gem 'parallel', require: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,41 @@
|
|
1
1
|
# master
|
2
2
|
|
3
|
+
# Version 5.0.0
|
4
|
+
|
5
|
+
## Breaking changes
|
6
|
+
|
7
|
+
* Try to align the gem version with the ElasticSearch version we support
|
8
|
+
|
9
|
+
* `Chewy.default_field_type` is `text` now.
|
10
|
+
|
11
|
+
* `Chewy::Stash` was split onto two indexes - `Chewy::Stash::Specification` and `Chewy::Stash::Journal`
|
12
|
+
|
13
|
+
* Data for journal and specification is stored in binary fields base64-encoded to bypass the limits of other fields.
|
14
|
+
|
15
|
+
* Don't underscore suggested index name (@dm1try, #626)
|
16
|
+
|
17
|
+
## Changes
|
18
|
+
|
19
|
+
* `pipeline` import option support (@eManPrague, #598)
|
20
|
+
|
21
|
+
* Proper Rails check (@nattfodd, #625)
|
22
|
+
|
23
|
+
* Bypass strategy performance improvements (@DNNX, #623)
|
24
|
+
|
25
|
+
* Avoid index update calls for empty data (@robertasg, #620)
|
26
|
+
|
27
|
+
* Do not underscore suggested index name on `Chewy::Index.index_name` call.
|
28
|
+
|
29
|
+
* It is possible now to call `root` method several times inside a single type definition, the options will be merged. Also, the block isn't required anymore.
|
30
|
+
|
31
|
+
* Fixed some Sequel deprecation warnings (@arturtr - #565, @matchbookmac - #577)
|
32
|
+
|
33
|
+
## Bugfixes
|
34
|
+
|
35
|
+
* Fixed index settings logic error (@yahooguntu, #593)
|
36
|
+
|
37
|
+
* Missed check in higlight method (@heartfulbird, #567)
|
38
|
+
|
3
39
|
# Version 0.10.1
|
4
40
|
|
5
41
|
## Changes
|
data/Gemfile
CHANGED
@@ -8,9 +8,11 @@ gem 'activerecord'
|
|
8
8
|
|
9
9
|
gem 'activejob', require: false
|
10
10
|
gem 'resque', require: false
|
11
|
-
gem 'shoryuken', require: false
|
12
11
|
gem 'sidekiq', require: false
|
13
12
|
|
13
|
+
gem 'aws-sdk-sqs', require: false
|
14
|
+
gem 'shoryuken', require: false
|
15
|
+
|
14
16
|
gem 'kaminari-core', require: false
|
15
17
|
gem 'will_paginate', require: false
|
16
18
|
|
data/README.md
CHANGED
@@ -208,7 +208,7 @@ If you would like to use AWS's ElasticSearch using an IAM user policy, you will
|
|
208
208
|
|
209
209
|
define_type User.active.includes(:country, :badges, :projects) do
|
210
210
|
root date_detection: false do
|
211
|
-
template 'about_translations.*', type: '
|
211
|
+
template 'about_translations.*', type: 'text', analyzer: 'standard'
|
212
212
|
|
213
213
|
field :first_name, :last_name
|
214
214
|
field :email, analyzer: 'email'
|
@@ -335,7 +335,7 @@ This will automatically set the type or root field to `object`. You may also spe
|
|
335
335
|
To define a multi field you have to specify any type except for `object` or `nested` in the root field:
|
336
336
|
|
337
337
|
```ruby
|
338
|
-
field :full_name, type: '
|
338
|
+
field :full_name, type: 'text', value: ->{ full_name.strip } do
|
339
339
|
field :ordered, analyzer: 'ordered'
|
340
340
|
field :untouched, index: 'not_analyzed'
|
341
341
|
end
|
@@ -807,36 +807,86 @@ Chewy has notifying the following events:
|
|
807
807
|
To integrate with NewRelic you may use the following example source (config/initializers/chewy.rb):
|
808
808
|
|
809
809
|
```ruby
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
NewRelic::Agent.instance.transaction_sampler.notice_sql(logged, nil, duration)
|
817
|
-
NewRelic::Agent.instance.sql_sampler.notice_sql(logged, metric_name, nil, duration)
|
818
|
-
NewRelic::Agent.record_metric(metric_name, duration)
|
810
|
+
require 'new_relic/agent/instrumentation/evented_subscriber'
|
811
|
+
|
812
|
+
class ChewySubscriber < NewRelic::Agent::Instrumentation::EventedSubscriber
|
813
|
+
def start(name, id, payload)
|
814
|
+
event = ChewyEvent.new(name, Time.current, nil, id, payload)
|
815
|
+
push_event(event)
|
819
816
|
end
|
820
|
-
end
|
821
817
|
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
818
|
+
def finish(_name, id, _payload)
|
819
|
+
pop_event(id).finish
|
820
|
+
end
|
821
|
+
|
822
|
+
class ChewyEvent < NewRelic::Agent::Instrumentation::Event
|
823
|
+
OPERATIONS = {
|
824
|
+
'import_objects.chewy' => 'import',
|
825
|
+
'search_query.chewy' => 'search',
|
826
|
+
'delete_query.chewy' => 'delete'
|
827
|
+
}.freeze
|
828
|
+
|
829
|
+
def initialize(*args)
|
830
|
+
super
|
831
|
+
@segment = start_segment
|
832
|
+
end
|
833
|
+
|
834
|
+
def start_segment
|
835
|
+
segment = NewRelic::Agent::Transaction::DatastoreSegment.new product, operation, collection, host, port
|
836
|
+
if (txn = state.current_transaction)
|
837
|
+
segment.transaction = txn
|
838
|
+
end
|
839
|
+
segment.notice_sql @payload[:request].to_s
|
840
|
+
segment.start
|
841
|
+
segment
|
842
|
+
end
|
843
|
+
|
844
|
+
def finish
|
845
|
+
if (txn = state.current_transaction)
|
846
|
+
txn.add_segment @segment
|
847
|
+
end
|
848
|
+
@segment.finish
|
849
|
+
end
|
850
|
+
|
851
|
+
private
|
826
852
|
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
853
|
+
def state
|
854
|
+
@state ||= NewRelic::Agent::TransactionState.tl_get
|
855
|
+
end
|
856
|
+
|
857
|
+
def product
|
858
|
+
'Elasticsearch'
|
859
|
+
end
|
860
|
+
|
861
|
+
def operation
|
862
|
+
OPERATIONS[name]
|
863
|
+
end
|
864
|
+
|
865
|
+
def collection
|
866
|
+
payload.values_at(:type, :index)
|
867
|
+
.reject { |value| value.try(:empty?) }
|
868
|
+
.first
|
869
|
+
.to_s
|
870
|
+
end
|
871
|
+
|
872
|
+
def host
|
873
|
+
Chewy.client.transport.hosts.first[:host]
|
874
|
+
end
|
875
|
+
|
876
|
+
def port
|
877
|
+
Chewy.client.transport.hosts.first[:port]
|
878
|
+
end
|
831
879
|
end
|
832
880
|
end
|
881
|
+
|
882
|
+
ActiveSupport::Notifications.subscribe(/.chewy$/, ChewySubscriber.new)
|
833
883
|
```
|
834
884
|
|
835
885
|
### Search requests
|
836
886
|
|
837
887
|
Long story short: there is a new DSL that supports ES2 and ES5, the previous DSL version (which supports ES1 and ES2) documentation was moved to [LEGACY_DSL.md](LEGACY_DSL.md).
|
838
888
|
|
839
|
-
If you want to use
|
889
|
+
If you want to use the old DSL - simply do `Chewy.search_class = Chewy::Query` somewhere before indices are initialized.
|
840
890
|
|
841
891
|
The new DSL is enabled by default, here is a quick introduction.
|
842
892
|
|
@@ -936,9 +986,9 @@ rake chewy:reset[-users,places] # resets every index in the application except s
|
|
936
986
|
|
937
987
|
Performs reset exactly the same way as `chewy:reset` does, but only when the index specification (setting or mapping) was changed.
|
938
988
|
|
939
|
-
It works only when index specification is locked in `Chewy::Stash` index. The first run will reset all indexes and lock their specifications.
|
989
|
+
It works only when index specification is locked in `Chewy::Stash::Specification` index. The first run will reset all indexes and lock their specifications.
|
940
990
|
|
941
|
-
See [Chewy::Stash](lib/chewy/stash.rb) and [Chewy::Index::Specification](lib/chewy/index/specification.rb) for more details.
|
991
|
+
See [Chewy::Stash::Specification](lib/chewy/stash.rb) and [Chewy::Index::Specification](lib/chewy/index/specification.rb) for more details.
|
942
992
|
|
943
993
|
|
944
994
|
```bash
|
data/chewy.gemspec
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
1
|
lib = File.expand_path('../lib', __FILE__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
require 'chewy/version'
|
@@ -19,17 +17,17 @@ Gem::Specification.new do |spec| # rubocop:disable BlockLength
|
|
19
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
18
|
spec.require_paths = ['lib']
|
21
19
|
|
22
|
-
spec.add_development_dependency 'rake'
|
23
20
|
spec.add_development_dependency 'appraisal'
|
24
|
-
spec.add_development_dependency 'rspec'
|
25
|
-
spec.add_development_dependency 'rspec-its'
|
26
|
-
spec.add_development_dependency 'rspec-collection_matchers'
|
27
|
-
spec.add_development_dependency 'sqlite3'
|
28
21
|
spec.add_development_dependency 'database_cleaner'
|
29
22
|
spec.add_development_dependency 'elasticsearch-extensions'
|
23
|
+
spec.add_development_dependency 'rake'
|
30
24
|
spec.add_development_dependency 'resque_spec'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'rspec-collection_matchers'
|
27
|
+
spec.add_development_dependency 'rspec-its'
|
28
|
+
spec.add_development_dependency 'rubocop', '0.52.1'
|
29
|
+
spec.add_development_dependency 'sqlite3'
|
31
30
|
spec.add_development_dependency 'timecop'
|
32
|
-
spec.add_development_dependency 'rubocop', '0.48.1'
|
33
31
|
|
34
32
|
spec.add_development_dependency 'method_source'
|
35
33
|
spec.add_development_dependency 'unparser'
|