Skip to content

Commit 63c24c9

Browse files
Kelly Joseph Pricepicandocodigo
Kelly Joseph Price
authored andcommitted
Add pipeline to bulk params
1 parent 1c34f6c commit 63c24c9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

elasticsearch-model/lib/elasticsearch/model/importing.rb

+10-4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def import(options={}, &block)
143143
target_index = options.delete(:index) || index_name
144144
target_type = options.delete(:type) || document_type
145145
transform = options.delete(:transform) || __transform
146+
pipeline = options.delete(:pipeline)
146147
return_value = options.delete(:return) || 'count'
147148

148149
unless transform.respond_to?(:call)
@@ -158,10 +159,15 @@ def import(options={}, &block)
158159
end
159160

160161
__find_in_batches(options) do |batch|
161-
response = client.bulk \
162-
index: target_index,
163-
type: target_type,
164-
body: __batch_to_bulk(batch, transform)
162+
params = {
163+
index: target_index,
164+
type: target_type,
165+
body: __batch_to_bulk(batch, transform)
166+
}
167+
168+
params[:pipeline] = pipeline if pipeline
169+
170+
response = client.bulk params
165171

166172
yield response if block_given?
167173

0 commit comments

Comments
 (0)