diff --git a/lib/chewy/search/scrolling.rb b/lib/chewy/search/scrolling.rb index 685b1552a..6074b3252 100644 --- a/lib/chewy/search/scrolling.rb +++ b/lib/chewy/search/scrolling.rb @@ -44,7 +44,7 @@ def scroll_batches(batch_size: Request::DEFAULT_BATCH_SIZE, scroll: Request::DEF result = perform_scroll(scroll: scroll, scroll_id: scroll_id) end ensure - Chewy.client.clear_scroll(scroll_id: scroll_id) if scroll_id + Chewy.client.clear_scroll(body: {scroll_id: scroll_id}) if scroll_id end # @!method scroll_hits(batch_size: 1000, scroll: '1m') diff --git a/spec/chewy/search/scrolling_spec.rb b/spec/chewy/search/scrolling_spec.rb index db714a43d..4dfe68941 100644 --- a/spec/chewy/search/scrolling_spec.rb +++ b/spec/chewy/search/scrolling_spec.rb @@ -106,7 +106,7 @@ end it 'clears the scroll after completion' do - expect(Chewy.client).to receive(:clear_scroll).with(scroll_id: anything).once.and_call_original + expect(Chewy.client).to receive(:clear_scroll).with(body: {scroll_id: anything}).once.and_call_original request.scroll_batches(batch_size: 3) {} end