es-elasticity 0.13.4 → 0.14.0.jhumphreys

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cddf215cbd343a666cede00c6788eb6f6dd27491dee5f54571bf46ca0c05ef5
4
- data.tar.gz: f354ee81b1cf462dc989ecdc7a2d56ebfdd41ca1ef842d4607d01fe201850a3e
3
+ metadata.gz: 45c241fb10e66d1410888110d39ea29e6f40c9781143af2a90a3552506e31f79
4
+ data.tar.gz: 16c9990ba2d5c6e53e7fcc595b19edfb6deeabbb2b88f7fee9da3db10c7cd8a6
5
5
  SHA512:
6
- metadata.gz: 14906fd419d5d9f0bd5226aea44fb6a0f6305b719882cf0357d7e075efc42a439f505e318f3858424b4f967e93588a3d9e28b1ea336badade23b4ddb30af9d0d
7
- data.tar.gz: 2f9a5ce3a207948e8dc03f0e47e716e44873341aa32389a016c120f8e6592e3ae20dfc0dc1a59cb6a7155858a30442e6260ef3c389ee8bee2cbb952cd9968015
6
+ metadata.gz: c347ccfebf05cad02bf0d4ee337fe3d3c260592c9434c74e56fa24803c862feacbf92fdee2bcd0571a0c2a5adc7327f06a41e0879c936b415ab4dab45e658352
7
+ data.tar.gz: fb62c2e4b6e1e99703751ca0f66c652d2d6669c857e3013cdf64c3194a31b52603b6be96f6bba66a9d370165c87d75cc3c48045a9000d8051ded94e2ae7bd89e
data/.circleci/config.yml CHANGED
@@ -4,47 +4,47 @@ orbs:
4
4
  gem: doximity/gem-publisher@0
5
5
 
6
6
  executors:
7
-
8
7
  # used for building the gem
9
8
  ruby-latest:
10
9
  resource_class: small
11
10
  docker:
12
- - image: circleci/ruby:latest
11
+ - image: cimg/ruby:3.1
13
12
  environment:
14
- BUNDLE_VERSION: "~> 1.17"
13
+ BUNDLE_VERSION: '~> 2.3.4'
15
14
 
16
15
  # used for testing the gem:
17
- ruby_2_5:
16
+ ruby_2_7:
18
17
  resource_class: small
19
18
  docker:
20
- - image: circleci/ruby:2.5
19
+ - image: cimg/ruby:2.7
21
20
  environment:
22
- BUNDLE_VERSION: "~> 1.17"
23
- - image: elastic/elasticsearch:6.8.2
21
+ BUNDLE_VERSION: '~> 2.3.4'
22
+ - image: docker.elastic.co/elasticsearch/elasticsearch:7.17.3
24
23
  environment:
25
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
24
+ - 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
26
25
  - discovery.type=single-node
27
26
  - xpack.security.enabled=false
28
- ruby_2_6:
27
+ ruby_3_0:
29
28
  resource_class: small
30
29
  docker:
31
- - image: circleci/ruby:2.6
30
+ - image: cimg/ruby:3.0
32
31
  environment:
33
- BUNDLE_VERSION: "~> 1.17"
34
- - image: elastic/elasticsearch:6.8.2
32
+ BUNDLE_VERSION: '~> 2.3.4'
33
+ - image: docker.elastic.co/elasticsearch/elasticsearch:7.17.3
35
34
  environment:
36
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
35
+ - 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
37
36
  - discovery.type=single-node
38
37
  - xpack.security.enabled=false
39
- ruby_2_7:
38
+
39
+ ruby_3_1:
40
40
  resource_class: small
41
41
  docker:
42
- - image: circleci/ruby:2.7
42
+ - image: cimg/ruby:3.1
43
43
  environment:
44
- BUNDLE_VERSION: "~> 1.17"
45
- - image: elastic/elasticsearch:6.8.2
44
+ BUNDLE_VERSION: '~> 2.3.4'
45
+ - image: docker.elastic.co/elasticsearch/elasticsearch:7.17.3
46
46
  environment:
47
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
47
+ - 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
48
48
  - discovery.type=single-node
49
49
  - xpack.security.enabled=false
50
50
 
@@ -69,8 +69,8 @@ version_tags_only: &version_tags_only
69
69
  only: /^v.*/
70
70
 
71
71
  jobs:
72
- build_2_5:
73
- executor: ruby_2_5
72
+ build_2_7:
73
+ executor: ruby_2_7
74
74
  steps:
75
75
  - checkout
76
76
  - run:
@@ -79,12 +79,12 @@ jobs:
79
79
  gem install bundler --version "${BUNDLE_VERSION}" --force
80
80
  - restore_cache:
81
81
  keys:
82
- - v1-bundle-ruby_2_5-{{ checksum "Gemfile.lock" }}
82
+ - v2-bundle-ruby_2_7-{{ checksum "Gemfile.lock" }}
83
83
  - run:
84
84
  name: Install Ruby Dependencies
85
85
  command: bundle check --path=vendor/bundle || bundle install --local --frozen --path=vendor/bundle --jobs=4 --retry=3
86
86
  - save_cache:
87
- key: v1-bundle-ruby_2_5-{{ checksum "Gemfile.lock" }}
87
+ key: v2-bundle-ruby_2_7-{{ checksum "Gemfile.lock" }}
88
88
  paths:
89
89
  - vendor/bundle
90
90
  - run:
@@ -97,8 +97,8 @@ jobs:
97
97
  root: .
98
98
  paths:
99
99
  - vendor/bundle
100
- build_2_6:
101
- executor: ruby_2_6
100
+ build_3_0:
101
+ executor: ruby_3_0
102
102
  steps:
103
103
  - checkout
104
104
  - run:
@@ -107,12 +107,12 @@ jobs:
107
107
  gem install bundler --version "${BUNDLE_VERSION}" --force
108
108
  - restore_cache:
109
109
  keys:
110
- - v1-bundle-ruby_2_6-{{ checksum "Gemfile.lock" }}
110
+ - v2-bundle-ruby_3_0-{{ checksum "Gemfile.lock" }}
111
111
  - run:
112
112
  name: Install Ruby Dependencies
113
113
  command: bundle check --path=vendor/bundle || bundle install --local --frozen --path=vendor/bundle --jobs=4 --retry=3
114
114
  - save_cache:
115
- key: v1-bundle-ruby_2_6-{{ checksum "Gemfile.lock" }}
115
+ key: v2-bundle-ruby_3_0-{{ checksum "Gemfile.lock" }}
116
116
  paths:
117
117
  - vendor/bundle
118
118
  - run:
@@ -125,8 +125,9 @@ jobs:
125
125
  root: .
126
126
  paths:
127
127
  - vendor/bundle
128
- build_2_7:
129
- executor: ruby_2_7
128
+
129
+ build_3_1:
130
+ executor: ruby_3_1
130
131
  steps:
131
132
  - checkout
132
133
  - run:
@@ -135,12 +136,12 @@ jobs:
135
136
  gem install bundler --version "${BUNDLE_VERSION}" --force
136
137
  - restore_cache:
137
138
  keys:
138
- - v1-bundle-ruby_2_7-{{ checksum "Gemfile.lock" }}
139
+ - v2-bundle-ruby_3_1-{{ checksum "Gemfile.lock" }}
139
140
  - run:
140
141
  name: Install Ruby Dependencies
141
142
  command: bundle check --path=vendor/bundle || bundle install --local --frozen --path=vendor/bundle --jobs=4 --retry=3
142
143
  - save_cache:
143
- key: v1-bundle-ruby_2_7-{{ checksum "Gemfile.lock" }}
144
+ key: v2-bundle-ruby_3_1-{{ checksum "Gemfile.lock" }}
144
145
  paths:
145
146
  - vendor/bundle
146
147
  - run:
@@ -158,33 +159,33 @@ workflows:
158
159
  version: 2
159
160
  trunk:
160
161
  jobs:
161
- - build_2_5:
162
+ - build_2_7:
162
163
  <<: *master_only
163
- - build_2_6:
164
+ - build_3_0:
164
165
  <<: *master_only
165
- - build_2_7:
166
+ - build_3_1:
166
167
  <<: *master_only
167
168
  - gem/build:
168
169
  <<: *master_only
169
170
  executor: ruby-latest
170
171
  name: gem-build
171
172
  requires:
172
- - build_2_5
173
+ - build_3_1
173
174
 
174
175
  pull-requests:
175
176
  jobs:
176
- - build_2_5:
177
+ - build_2_7:
177
178
  <<: *pr_only
178
- - build_2_6:
179
+ - build_3_0:
179
180
  <<: *pr_only
180
- - build_2_7:
181
+ - build_3_1:
181
182
  <<: *pr_only
182
183
  - gem/build:
183
184
  <<: *pr_only
184
185
  executor: ruby-latest
185
186
  name: gem-build
186
187
  requires:
187
- - build_2_5
188
+ - build_3_1
188
189
  - pre-release-approval:
189
190
  <<: *pr_only
190
191
  type: approval
@@ -201,18 +202,18 @@ workflows:
201
202
 
202
203
  final-release:
203
204
  jobs:
204
- - build_2_5:
205
+ - build_2_7:
205
206
  <<: *version_tags_only
206
- - build_2_6:
207
+ - build_3_0:
207
208
  <<: *version_tags_only
208
- - build_2_7:
209
+ - build_3_1:
209
210
  <<: *version_tags_only
210
211
  - gem/build:
211
212
  <<: *version_tags_only
212
213
  executor: ruby-latest
213
214
  name: gem-build
214
215
  requires:
215
- - build_2_5
216
+ - build_3_1
216
217
  - gem/publish:
217
218
  <<: *version_tags_only
218
219
  name: gem-publish
data/CHANGELOG.md CHANGED
@@ -6,26 +6,54 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.14.0.jhumphreys] - 2022-08-03
10
+
11
+ ### Changed
12
+
13
+ - Use `refresh` instead of `flush` where search is expected to be updated
14
+ - Drop support for Ruby 2.5 and 2.6
15
+ - Add support for Ruby 2.7 and 3.0, build against Ruby 3.1
16
+ - Set `search_type` to `query_then_fetch` as we no longer support Elasticsearch version < 7.0
17
+ - Set `include_type_name` when fetching the mapping. Will be removed in the next version to support ES version 8.
18
+ - Index names automatically use the new timestamp format when creating an index.
19
+ - Don't raise an exception when index doesn't exist when calling `missing?` in SingleIndex strategy.
20
+
21
+ ## [0.13.5] - 2020-05-21
22
+
23
+ ### Changed
24
+
25
+ - expose 'matched_queries' property
26
+
9
27
  ## [0.13.4] - 2020-05-20
28
+
10
29
  ### Changed
30
+
11
31
  - Compatibility with Rails 6
12
32
 
13
33
  ## [0.13.3] - 2020-01-30
34
+
14
35
  ### Changed
36
+
15
37
  - Release on RubyGems using gem-publisher CircleCI Orb
16
38
 
17
39
  ## [0.13.2] - 2020-01-29
40
+
18
41
  ### Changed
42
+
19
43
  - Release on Nexus using gem-publisher CircleCI Orb
20
44
  - Packing gems
21
45
  - bump the version for testing the Nexus repo
22
46
 
23
47
  ## [0.13.1]
48
+
24
49
  ### Changed
50
+
25
51
  - remove superfluous 'to_ary' delegation that was causing issues downstream
26
52
 
27
53
  ## [0.13.0]
54
+
28
55
  ### Changed
56
+
29
57
  - changes needed for use with Elasticsearch v7
30
58
  - handle the v7 "total" as an object rather than a scalar
31
59
  - use timestamp with no colons
@@ -34,114 +62,165 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
34
62
  - allow for optional 'include_type_name_on_create' arg so that the :include_type_name can be passed
35
63
 
36
64
  ## [0.12.1]
65
+
37
66
  ### Changed
67
+
38
68
  - use Arel.sql to avoid unsafe sql and eliminate deprecation warnings when used in Rails projects
39
69
 
40
70
  ## [0.12.0]
71
+
41
72
  ### Changed
73
+
42
74
  - warn when configuring a index with subclasses if using ES version that does support them
43
75
  - raise exception when creating or adding document to an index configured with subclasses if using an ES version that does not support them
44
76
 
45
77
  ## [0.11.5]
78
+
46
79
  ### Changed
80
+
47
81
  - Give the option of retrying the deletion for certain exceptions during remap
48
82
 
49
83
  ## [0.11.4]
84
+
50
85
  ### Changed
86
+
51
87
  - Fully clean up if error occurs during remap (assign all aliases back to original index)
52
88
 
53
89
  ## [0.11.3]
90
+
54
91
  ### Added
92
+
55
93
  - Adds support for preserving the order or normalized names of `highlight` through `highlighted_attrs`
56
94
 
57
95
  ## [0.11.2]
96
+
58
97
  ### Added
98
+
59
99
  - Adds support for passing arguments to Search definition through `search(query, search_args)` in index searching and msearch
60
100
  - adds `_explanation` to hold value of returned explanations in the base document
61
101
 
62
102
  ## [0.11.1]
103
+
63
104
  ### Changed
105
+
64
106
  - support `action.destructive_requires_name` setting by being explict about which indices to delete
65
107
 
66
108
  ## [0.11.0]
109
+
67
110
  ### Changed
111
+
68
112
  - compatibilty with ES v6
69
113
  - change mappings for 'index' to boolean. "string" type was replaced with "text"
70
114
  - use "successful" from API response ('created' was removed)
71
115
  - stringify keys for :mappings so clients can use symbol keys
72
116
 
73
117
  ## [0.10.0]
118
+
74
119
  ### Changed
120
+
75
121
  - update remap to removing fields from the mapping that are not explicitly defined.
76
122
 
77
123
  ## [0.9.1]
124
+
78
125
  ### Changed
126
+
79
127
  - fix search enumerator, missing first result set
80
128
 
81
129
  ## [0.8.3]
130
+
82
131
  ### Changed
132
+
83
133
  - fix remap method to use the scan api properly.
84
134
 
85
135
  ## [0.8.2]
136
+
86
137
  ### Changed
138
+
87
139
  - fix scan api to work with more recent versions of elasticsearch ruby.
88
140
 
89
141
  ## [0.8.1]
142
+
90
143
  ### Changed
144
+
91
145
  - loosen support for elasticsearch-ruby versions to support more versions of elasticsearch
92
146
 
93
147
  ## [0.8.0]
148
+
94
149
  ### Changed
150
+
95
151
  - Make Elasticity::Strategies::AliasIndex the default
96
152
  - Use mapping instead of mappings, we wanna be consistent to ES not to elasticsearch-ruby
97
153
  - Better automatic index name and document type
98
154
 
99
155
  ## [v0.7.1]
156
+
100
157
  ### Added
158
+
101
159
  - add more response info to raised exceptions from reindexing
102
160
 
103
161
  ## [v0.6.5]
162
+
104
163
  ### Changed
164
+
105
165
  - update search and multi search interfaces to allow passing of general search definition arguments found in https://github.com/elastic/elasticsearch-ruby/blob/bdf5e145e5acc21726dddcd34492debbbddde568/elasticsearch-api/lib/elasticsearch/api/actions/search.rb#L125-L162
106
166
 
107
167
  ## [v0.6.4]
168
+
108
169
  ### Changed
170
+
109
171
  - update suggestions to pull from the proper key
110
172
 
111
173
  ## [v0.6.3]
174
+
112
175
  ### Added
176
+
113
177
  - add next_page and previous_page to be compatible with will_paginate interface
114
178
 
115
179
  ## [0.6.2]
180
+
116
181
  ### Changed
182
+
117
183
  - update multi search `[]` method to raise an exception with key name to make it easier to debug failed queries within a multi search hash.
118
184
 
119
185
  ## [0.6.0]
186
+
120
187
  ### Changed
121
- - Change documents to be able to define indexes with multiple doc types. A Document class can define subclasses which are of different doc_types and all live in the same index's mappings.
188
+
189
+ - Change documents to be able to define indexes with multiple doc types. A Document class can define subclasses which are of different doc_types and all live in the same index's mappings.
122
190
  - updated search queries to pass either a list of document types or a single document type.
123
191
  - Update documents to generate a default document_type from the class name so that Documents always have a document type. You'll still usually want to manually define the document type, but it's no longer necessary.
124
192
 
125
193
  ## [0.5.2]
194
+
126
195
  ### Added
196
+
127
197
  - Add aggregations to multi_search
128
198
 
129
199
  ## [0.5.1]
200
+
130
201
  ### Added
202
+
131
203
  - Add ability to reindex individual attributes of a document using the bulk_update API.
132
204
 
133
205
  ## [v0.5.0]
206
+
134
207
  ### Changed
208
+
135
209
  - Refactor of multisearch and search facade
136
210
  - Searches no longer return a simple array, they now return the Search::Results object which proxies array and is enumerable.
137
211
 
138
212
  ### Added
213
+
139
214
  - add Search::Results proxy object so pagination and meta data methods can be standardize across all responses
140
215
 
141
216
  ## [v0.4.5]
217
+
142
218
  ### Changed
219
+
143
220
  - Fix issue with hash strings and pagination
144
221
 
145
222
  ## [v0.4.4]
223
+
146
224
  ### Added
225
+
147
226
  - Added support for surfacing document `_score` on query results.
data/CONTRIBUTING.md CHANGED
@@ -1,31 +1,30 @@
1
- # Contributing
1
+ # Contributing to Doximity
2
2
 
3
3
  We welcome contributions to this repository. Feel free to submit issues for bugs you encounter and pull requests for code and documentation contributions.
4
+ In order to prevent licensing issues, Doximity Inc. (“Doximity”, “we”, “us”) requires all contributors to agree to an Individual Contributor License Agreement (“CLA”), which is reproduced below. By submitting your contributions to us, you agree that you have read and are bound by the CLA. If you do not agree with the CLA, you may not submit contributions.
4
5
 
5
- In order to prevent licensing issues, we require all contributors to sign an individual contributor license agreement, which is reproduced below:
6
+ ## Doximity Individual Contributor License Agreement
6
7
 
7
- ## Individual Contributor License Agreement
8
+ This license is for your protection as a Contributor as well as the protection of Doximity; it does not change your rights to use your own Contributions for any other purpose.
8
9
 
9
- In order to clarify the intellectual property license granted with Contributions from any person or entity, Doximity, Inc. ("Doximity") must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Doximity; it does not change your rights to use your own Contributions for any other purpose.
10
-
11
- You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Doximity. Except for the license granted herein to Doximity and recipients of software distributed by Doximity, You reserve all right, title, and interest in and to Your Contributions.
10
+ You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Doximity. Except for the license granted herein to Doximity and recipients of software distributed by Doximity, You reserve all right, titles, and interests in and to Your Contributions.
12
11
 
13
12
  ### Definitions
14
13
 
15
- "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Doximity. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+ "You" (or "Your" or the “Contributor”) shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Doximity. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
15
 
17
- 1. "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Doximity for inclusion in, or documentation of, any of the products owned or managed by Doximity (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Doximity or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Doximity for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
16
+ 1. "Contribution" shall mean the code, documentation, or any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Doximity for inclusion in, or documentation of, any of the products owned or managed by Doximity (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Doximity or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Doximity for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
18
17
 
19
18
  2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Doximity and to recipients of software distributed by Doximity a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
20
19
 
21
- 3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Doximity and to recipients of software distributed by Doximity a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
20
+ 3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Doximity and to recipients of software distributed by Doximity a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by a combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes a direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
22
21
 
23
- 4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Doximity, or that your employer has executed a separate Corporate CLA with Doximity.
22
+ 4. You represent that You are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Doximity, or that your employer has executed a separate Corporate CLA with Doximity.
24
23
 
25
24
  5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
26
25
 
27
- 6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
26
+ 6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
28
27
 
29
- 7. Should You wish to submit work that is not Your original creation, You may submit it to Doximity separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [[]named here]".
28
+ 7. Should You wish to submit work that is not Your original creation, You may submit it to Doximity separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
30
29
 
31
30
  8. You agree to notify Doximity of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
data/Gemfile.lock CHANGED
@@ -1,48 +1,68 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- es-elasticity (0.13.4)
5
- activemodel (>= 4.0.0, < 7)
6
- activerecord (>= 4.0.0, < 7)
7
- activesupport (>= 4.0.0, < 7)
8
- elasticsearch (>= 1.0)
4
+ es-elasticity (0.14.0.jhumphreys)
5
+ activemodel (>= 5.2.0, < 7.1)
6
+ activerecord (>= 5.2.0, < 7.1)
7
+ activesupport (>= 5.2.0, < 7.1)
8
+ elasticsearch (>= 7, < 8)
9
9
 
10
10
  GEM
11
11
  remote: https://artifacts.dox.support/repository/gems/
12
12
  specs:
13
- activemodel (6.0.3.1)
14
- activesupport (= 6.0.3.1)
15
- activerecord (6.0.3.1)
16
- activemodel (= 6.0.3.1)
17
- activesupport (= 6.0.3.1)
18
- activesupport (6.0.3.1)
13
+ activemodel (7.0.3.1)
14
+ activesupport (= 7.0.3.1)
15
+ activerecord (7.0.3.1)
16
+ activemodel (= 7.0.3.1)
17
+ activesupport (= 7.0.3.1)
18
+ activesupport (7.0.3.1)
19
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
- i18n (>= 0.7, < 2)
21
- minitest (~> 5.1)
22
- tzinfo (~> 1.1)
23
- zeitwerk (~> 2.2, >= 2.2.2)
20
+ i18n (>= 1.6, < 2)
21
+ minitest (>= 5.1)
22
+ tzinfo (~> 2.0)
24
23
  byebug (11.0.1)
25
24
  codeclimate-test-reporter (1.0.9)
26
25
  simplecov (<= 0.13)
27
26
  coderay (1.1.2)
28
- concurrent-ruby (1.1.6)
27
+ concurrent-ruby (1.1.10)
29
28
  diff-lcs (1.3)
30
- elasticsearch (7.7.0)
31
- elasticsearch-api (= 7.7.0)
32
- elasticsearch-transport (= 7.7.0)
33
- elasticsearch-api (7.7.0)
29
+ elasticsearch (7.17.1)
30
+ elasticsearch-api (= 7.17.1)
31
+ elasticsearch-transport (= 7.17.1)
32
+ elasticsearch-api (7.17.1)
34
33
  multi_json
35
- elasticsearch-transport (7.7.0)
34
+ elasticsearch-transport (7.17.1)
36
35
  faraday (~> 1)
37
36
  multi_json
38
- faraday (1.0.1)
39
- multipart-post (>= 1.2, < 3)
40
- i18n (1.8.2)
37
+ faraday (1.10.0)
38
+ faraday-em_http (~> 1.0)
39
+ faraday-em_synchrony (~> 1.0)
40
+ faraday-excon (~> 1.1)
41
+ faraday-httpclient (~> 1.0)
42
+ faraday-multipart (~> 1.0)
43
+ faraday-net_http (~> 1.0)
44
+ faraday-net_http_persistent (~> 1.0)
45
+ faraday-patron (~> 1.0)
46
+ faraday-rack (~> 1.0)
47
+ faraday-retry (~> 1.0)
48
+ ruby2_keywords (>= 0.0.4)
49
+ faraday-em_http (1.0.0)
50
+ faraday-em_synchrony (1.0.0)
51
+ faraday-excon (1.1.0)
52
+ faraday-httpclient (1.0.1)
53
+ faraday-multipart (1.0.4)
54
+ multipart-post (~> 2)
55
+ faraday-net_http (1.0.1)
56
+ faraday-net_http_persistent (1.2.0)
57
+ faraday-patron (1.0.0)
58
+ faraday-rack (1.0.0)
59
+ faraday-retry (1.0.3)
60
+ i18n (1.12.0)
41
61
  concurrent-ruby (~> 1.0)
42
62
  method_source (0.9.2)
43
- minitest (5.14.1)
44
- multi_json (1.14.1)
45
- multipart-post (2.1.1)
63
+ minitest (5.16.2)
64
+ multi_json (1.15.0)
65
+ multipart-post (2.2.3)
46
66
  oj (3.10.0)
47
67
  pry (0.12.2)
48
68
  coderay (~> 1.1.0)
@@ -63,21 +83,20 @@ GEM
63
83
  rspec-support (3.1.2)
64
84
  rspec_junit_formatter (0.4.1)
65
85
  rspec-core (>= 2, < 4, != 2.12.0)
86
+ ruby2_keywords (0.0.5)
66
87
  simplecov (0.7.1)
67
88
  multi_json (~> 1.0)
68
89
  simplecov-html (~> 0.7.1)
69
90
  simplecov-html (0.7.1)
70
- thread_safe (0.3.6)
71
- timecop (0.9.1)
72
- tzinfo (1.2.7)
73
- thread_safe (~> 0.1)
74
- zeitwerk (2.3.0)
91
+ timecop (0.9.5)
92
+ tzinfo (2.0.5)
93
+ concurrent-ruby (~> 1.0)
75
94
 
76
95
  PLATFORMS
77
96
  ruby
78
97
 
79
98
  DEPENDENCIES
80
- bundler (~> 1.7)
99
+ bundler (~> 2.3.4)
81
100
  byebug
82
101
  codeclimate-test-reporter
83
102
  es-elasticity!
@@ -91,4 +110,4 @@ DEPENDENCIES
91
110
  timecop
92
111
 
93
112
  BUNDLED WITH
94
- 1.17.3
113
+ 2.3.4
data/README.md CHANGED
@@ -436,12 +436,12 @@ The default persistence strategy changed from SingleIndex to AliasIndex in versi
436
436
 
437
437
  ## Contributing
438
438
 
439
- 1. Fork it ( https://github.com/[my-github-username]/elasticity/fork )
440
- 2. Create your feature branch (`git checkout -b my-new-feature`)
441
- 3. Commit your changes (`git commit -am 'Add some feature'`)
442
- 4. Push to the branch (`git push origin my-new-feature`)
443
- 5. Create a new Pull Request
444
- 6. Sign the CLA if you haven't yet. See CONTRIBUTING.md
439
+ 1. See [CONTRIBUTING.md](./CONTRIBUTING.md)
440
+ 2. Fork it ( https://github.com/[my-github-username]/elasticity/fork )
441
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
442
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
443
+ 5. Push to the branch (`git push origin my-new-feature`)
444
+ 6. Create a new Pull Request
445
445
 
446
446
  ## Gem documentation
447
447
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "bundler", "~> 2.3.4"
25
25
  spec.add_development_dependency "byebug"
26
26
  spec.add_development_dependency "codeclimate-test-reporter"
27
27
  spec.add_development_dependency "oj"
@@ -33,8 +33,8 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "simplecov", "~> 0.7.1"
34
34
  spec.add_development_dependency "timecop"
35
35
 
36
- spec.add_dependency "activemodel", ">= 4.0.0", "< 7"
37
- spec.add_dependency "activerecord", ">= 4.0.0", "< 7"
38
- spec.add_dependency "activesupport", ">= 4.0.0", "< 7"
39
- spec.add_dependency "elasticsearch", ">= 1.0"
36
+ spec.add_dependency "activemodel", ">= 5.2.0", "< 7.1"
37
+ spec.add_dependency "activerecord", ">= 5.2.0", "< 7.1"
38
+ spec.add_dependency "activesupport", ">= 5.2.0", "< 7.1"
39
+ spec.add_dependency "elasticsearch", ">= 7", "< 8"
40
40
  end
@@ -12,7 +12,7 @@ module Elasticity
12
12
  end
13
13
 
14
14
  # Define common attributes for all documents
15
- attr_accessor :_id, :highlighted, :_score, :sort, :_explanation, :highlighted_attrs
15
+ attr_accessor :_id, :highlighted, :_score, :sort, :_explanation, :highlighted_attrs, :matched_queries
16
16
 
17
17
  def attributes=(attributes)
18
18
  attributes.each do |attr, value|
@@ -150,6 +150,7 @@ module Elasticity
150
150
  attrs.merge!(_score: hit["_score"])
151
151
  attrs.merge!(sort: hit["sort"])
152
152
  attrs.merge!(hit["_source"]) if hit["_source"]
153
+ attrs.merge!(matched_queries: hit["matched_queries"]) if hit["matched_queries"]
153
154
 
154
155
  highlighted = nil
155
156
 
@@ -186,7 +186,7 @@ module Elasticity
186
186
  def search
187
187
  return @search if defined?(@search)
188
188
  args = @search_definition.to_search_args
189
- args = args.merge(search_type: ScrollableSearch.search_type, size: @size, scroll: @scroll)
189
+ args = args.merge(search_type: :query_then_fetch, size: @size, scroll: @scroll)
190
190
  @search = @client.search(args)
191
191
  end
192
192
  end
@@ -11,14 +11,16 @@ module Elasticity
11
11
 
12
12
  STATUSES = [:missing, :ok]
13
13
 
14
- def initialize(client, index_base_name, document_type, use_new_timestamp_format = false, include_type_name_on_create = true)
14
+ def initialize(client, index_base_name, document_type, use_new_timestamp_format = true, include_type_name_on_create = true)
15
15
  @client = client
16
16
  @main_alias = index_base_name
17
17
  @update_alias = "#{index_base_name}_update"
18
18
  @document_type = document_type
19
19
 
20
- # included for compatibility with v7
20
+ # Deprecated: The use_new_timestamp_format option is no longer used and will be removed in the next version.
21
21
  @use_new_timestamp_format = use_new_timestamp_format
22
+
23
+ # included for compatibility with v7
22
24
  @include_type_name_on_create = include_type_name_on_create
23
25
  end
24
26
 
@@ -60,8 +62,8 @@ module Elasticity
60
62
  ]
61
63
  })
62
64
 
63
- @client.index_flush(index: original_index)
64
- cursor = @client.search index: original_index, search_type: ScrollableSearch.search_type, scroll: '10m', size: 100
65
+ @client.index_refresh(index: original_index)
66
+ cursor = @client.search index: original_index, search_type: :query_then_fetch, scroll: '10m', size: 100
65
67
  loop do
66
68
  hits = cursor['hits']['hits']
67
69
  break if hits.empty?
@@ -130,8 +132,8 @@ module Elasticity
130
132
  ]
131
133
  })
132
134
 
133
- @client.index_flush(index: new_index)
134
- cursor = @client.search index: new_index, search_type: ScrollableSearch.search_type, scroll: '1m', size: 100
135
+ @client.index_refresh(index: new_index)
136
+ cursor = @client.search index: new_index, search_type: :query_then_fetch, scroll: '1m', size: 100
135
137
  loop do
136
138
  hits = cursor['hits']['hits']
137
139
  break if hits.empty?
@@ -146,7 +148,7 @@ module Elasticity
146
148
  cursor = @client.scroll(scroll_id: cursor['_scroll_id'], scroll: '1m')
147
149
  end
148
150
 
149
- @client.index_flush(index: original_index)
151
+ @client.index_refresh(index: original_index)
150
152
  @client.index_update_aliases(body: {
151
153
  actions: [
152
154
  { remove: { index: new_index, alias: @main_alias } },
@@ -208,6 +210,7 @@ module Elasticity
208
210
  end
209
211
 
210
212
  def delete
213
+ # @client.index_delete_alias(index: "#{@main_alias}-*", name: "_all")
211
214
  main_indexes.each do |index|
212
215
  @client.index_delete(index: index)
213
216
  end
@@ -281,7 +284,7 @@ module Elasticity
281
284
  end
282
285
 
283
286
  def mapping
284
- @client.index_get_mapping(index: @main_alias, type: @document_type).values.first
287
+ @client.index_get_mapping(index: @main_alias, type: @document_type, include_type_name: @include_type_name_on_create).values.first
285
288
  rescue Elasticsearch::Transport::Transport::Errors::NotFound
286
289
  nil
287
290
  end
@@ -289,12 +292,7 @@ module Elasticity
289
292
  private
290
293
 
291
294
  def build_index_name
292
- ts = String.new
293
- if @use_new_timestamp_format == true
294
- ts = Time.now.utc.strftime("%Y%m%d%H%M%S%6N")
295
- else
296
- ts = Time.now.utc.strftime("%Y-%m-%d_%H:%M:%S.%6N")
297
- end
295
+ ts = Time.now.utc.strftime("%Y%m%d%H%M%S%6N")
298
296
  "#{@main_alias}-#{ts}"
299
297
  end
300
298
 
@@ -3,7 +3,7 @@ module Elasticity
3
3
  class SingleIndex
4
4
  STATUSES = [:missing, :ok]
5
5
 
6
- def initialize(client, index_name, document_type, use_new_timestamp_format = false, include_type_name_on_create = true)
6
+ def initialize(client, index_name, document_type, use_new_timestamp_format = true, include_type_name_on_create = true)
7
7
  @client = client
8
8
  @index_name = index_name
9
9
  @document_type = document_type
@@ -11,7 +11,7 @@ module Elasticity
11
11
  # included for compatibility with v7
12
12
  @include_type_name_on_create = include_type_name_on_create
13
13
 
14
- # not currently used. included for argument compatiblity with AliasStrategy
14
+ # Deprecated: The use_new_timestamp_format option is no longer used and will be removed in the next version.
15
15
  @use_new_timestamp_format = use_new_timestamp_format
16
16
  end
17
17
 
@@ -24,7 +24,7 @@ module Elasticity
24
24
  end
25
25
 
26
26
  def missing?
27
- not @client.index_exists(index: @index_name)
27
+ not @client.index_exists(index: @index_name, ignore: 404)
28
28
  end
29
29
 
30
30
  def create(index_def)
@@ -99,7 +99,7 @@ module Elasticity
99
99
  end
100
100
 
101
101
  def mapping
102
- @client.index_get_mapping(index: @index_name, type: @document_type).values.first
102
+ @client.index_get_mapping(index: @index_name, type: @document_type, include_type_name: @include_type_name_on_create).values.first
103
103
  rescue Elasticsearch::Transport::Transport::Errors::NotFound
104
104
  nil
105
105
  end
@@ -1,3 +1,3 @@
1
1
  module Elasticity
2
- VERSION = "0.13.4"
2
+ VERSION = "0.14.0.jhumphreys"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: es-elasticity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.4
4
+ version: 0.14.0.jhumphreys
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Kochenburger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-21 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: 2.3.4
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
- version: '1.7'
26
+ version: 2.3.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -170,74 +170,80 @@ dependencies:
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 4.0.0
173
+ version: 5.2.0
174
174
  - - "<"
175
175
  - !ruby/object:Gem::Version
176
- version: '7'
176
+ version: '7.1'
177
177
  type: :runtime
178
178
  prerelease: false
179
179
  version_requirements: !ruby/object:Gem::Requirement
180
180
  requirements:
181
181
  - - ">="
182
182
  - !ruby/object:Gem::Version
183
- version: 4.0.0
183
+ version: 5.2.0
184
184
  - - "<"
185
185
  - !ruby/object:Gem::Version
186
- version: '7'
186
+ version: '7.1'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: activerecord
189
189
  requirement: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - ">="
192
192
  - !ruby/object:Gem::Version
193
- version: 4.0.0
193
+ version: 5.2.0
194
194
  - - "<"
195
195
  - !ruby/object:Gem::Version
196
- version: '7'
196
+ version: '7.1'
197
197
  type: :runtime
198
198
  prerelease: false
199
199
  version_requirements: !ruby/object:Gem::Requirement
200
200
  requirements:
201
201
  - - ">="
202
202
  - !ruby/object:Gem::Version
203
- version: 4.0.0
203
+ version: 5.2.0
204
204
  - - "<"
205
205
  - !ruby/object:Gem::Version
206
- version: '7'
206
+ version: '7.1'
207
207
  - !ruby/object:Gem::Dependency
208
208
  name: activesupport
209
209
  requirement: !ruby/object:Gem::Requirement
210
210
  requirements:
211
211
  - - ">="
212
212
  - !ruby/object:Gem::Version
213
- version: 4.0.0
213
+ version: 5.2.0
214
214
  - - "<"
215
215
  - !ruby/object:Gem::Version
216
- version: '7'
216
+ version: '7.1'
217
217
  type: :runtime
218
218
  prerelease: false
219
219
  version_requirements: !ruby/object:Gem::Requirement
220
220
  requirements:
221
221
  - - ">="
222
222
  - !ruby/object:Gem::Version
223
- version: 4.0.0
223
+ version: 5.2.0
224
224
  - - "<"
225
225
  - !ruby/object:Gem::Version
226
- version: '7'
226
+ version: '7.1'
227
227
  - !ruby/object:Gem::Dependency
228
228
  name: elasticsearch
229
229
  requirement: !ruby/object:Gem::Requirement
230
230
  requirements:
231
231
  - - ">="
232
232
  - !ruby/object:Gem::Version
233
- version: '1.0'
233
+ version: '7'
234
+ - - "<"
235
+ - !ruby/object:Gem::Version
236
+ version: '8'
234
237
  type: :runtime
235
238
  prerelease: false
236
239
  version_requirements: !ruby/object:Gem::Requirement
237
240
  requirements:
238
241
  - - ">="
239
242
  - !ruby/object:Gem::Version
240
- version: '1.0'
243
+ version: '7'
244
+ - - "<"
245
+ - !ruby/object:Gem::Version
246
+ version: '8'
241
247
  description: Elasticity provides a higher level abstraction on top of [elasticsearch-ruby](https://github.com/elasticsearch/elasticsearch-ruby)
242
248
  gem
243
249
  email:
@@ -271,7 +277,6 @@ files:
271
277
  - lib/elasticity/multi_search.rb
272
278
  - lib/elasticity/multi_search_response_parser.rb
273
279
  - lib/elasticity/railtie.rb
274
- - lib/elasticity/scrollable_search.rb
275
280
  - lib/elasticity/search.rb
276
281
  - lib/elasticity/segmented_document.rb
277
282
  - lib/elasticity/strategies.rb
@@ -295,11 +300,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
295
300
  version: '0'
296
301
  required_rubygems_version: !ruby/object:Gem::Requirement
297
302
  requirements:
298
- - - ">="
303
+ - - ">"
299
304
  - !ruby/object:Gem::Version
300
- version: '0'
305
+ version: 1.3.1
301
306
  requirements: []
302
- rubygems_version: 3.1.2
307
+ rubygems_version: 3.3.11
303
308
  signing_key:
304
309
  specification_version: 4
305
310
  summary: ActiveModel-based library for working with Elasticsearch
@@ -1,15 +0,0 @@
1
- module Elasticity
2
- class ScrollableSearch
3
- def self.search_type
4
- if elasticsearch_gem_version < Gem::Version.create("2.0")
5
- :scan
6
- else
7
- :query_then_fetch
8
- end
9
- end
10
-
11
- def self.elasticsearch_gem_version
12
- Gem.loaded_specs["elasticsearch"].version
13
- end
14
- end
15
- end