Skip to content

Commit da7c666

Browse files
Remove deprecated type parameter from importing request
1 parent 5531f55 commit da7c666

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

opensearch-model/lib/opensearch/model/importing.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ module ClassMethods
9999
#
100100
# Article.import refresh: true
101101
#
102-
# @example Import the records into a different index/type than the default one
102+
# @example Import the records into a different index than the default one
103103
#
104-
# Article.import index: 'my-new-index', type: 'my-other-type'
104+
# Article.import index: 'my-new-index'
105105
#
106106
# @example Pass an ActiveRecord scope to limit the imported records
107107
#
@@ -141,7 +141,6 @@ def import(options={}, &block)
141141
errors = []
142142
refresh = options.delete(:refresh) || false
143143
target_index = options.delete(:index) || index_name
144-
target_type = options.delete(:type) || document_type
145144
transform = options.delete(:transform) || __transform
146145
pipeline = options.delete(:pipeline)
147146
return_value = options.delete(:return) || 'count'
@@ -161,7 +160,6 @@ def import(options={}, &block)
161160
__find_in_batches(options) do |batch|
162161
params = {
163162
index: target_index,
164-
type: target_type,
165163
body: __batch_to_bulk(batch, transform)
166164
}
167165

opensearch-model/spec/opensearch/model/importing_spec.rb

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def importing_mixin
6060

6161
before do
6262
allow(DummyImportingModel).to receive(:index_name).and_return('foo')
63-
allow(DummyImportingModel).to receive(:document_type).and_return('foo')
6463
allow(DummyImportingModel).to receive(:index_exists?).and_return(true)
6564
allow(DummyImportingModel).to receive(:__batch_to_bulk)
6665
allow(client).to receive(:bulk).and_return(response)
@@ -159,26 +158,14 @@ def importing_mixin
159158

160159
before do
161160
expect(DummyImportingModel).to receive(:client).and_return(client)
162-
expect(client).to receive(:bulk).with(body: nil, index: 'my-new-index', type: 'foo').and_return(response)
161+
expect(client).to receive(:bulk).with(body: nil, index: 'my-new-index').and_return(response)
163162
end
164163

165164
it 'uses the alternate index name' do
166165
expect(DummyImportingModel.import(index: 'my-new-index')).to eq(0)
167166
end
168167
end
169168

170-
context 'when a different document type is provided' do
171-
172-
before do
173-
expect(DummyImportingModel).to receive(:client).and_return(client)
174-
expect(client).to receive(:bulk).with(body: nil, index: 'foo', type: 'my-new-type').and_return(response)
175-
end
176-
177-
it 'uses the alternate index name' do
178-
expect(DummyImportingModel.import(type: 'my-new-type')).to eq(0)
179-
end
180-
end
181-
182169
context 'the transform method' do
183170

184171
before do
@@ -232,7 +219,7 @@ def importing_mixin
232219

233220
before do
234221
expect(DummyImportingModel).to receive(:client).and_return(client)
235-
expect(client).to receive(:bulk).with(body: nil, index: 'foo', type: 'foo', pipeline: 'my-pipeline').and_return(response)
222+
expect(client).to receive(:bulk).with(body: nil, index: 'foo', pipeline: 'my-pipeline').and_return(response)
236223
end
237224

238225
it 'uses the pipeline option' do

0 commit comments

Comments
 (0)