@@ -254,6 +254,8 @@ package object extension {
254
254
* The list of objects to save.
255
255
* @param waitForTasks
256
256
* Whether to wait for the tasks to complete.
257
+ * @param batchSize
258
+ * The size of the batch. Default is 1000.
257
259
* @param requestOptions
258
260
* Additional request configuration.
259
261
* @return
@@ -263,9 +265,10 @@ package object extension {
263
265
indexName : String ,
264
266
objects : Seq [Any ],
265
267
waitForTasks : Boolean = false ,
268
+ batchSize : Int = 1000 ,
266
269
requestOptions : Option [RequestOptions ] = None
267
270
)(implicit ec : ExecutionContext ): Future [Seq [BatchResponse ]] = {
268
- chunkedBatch(indexName, objects, Action .AddObject , waitForTasks, 1000 , requestOptions)
271
+ chunkedBatch(indexName, objects, Action .AddObject , waitForTasks, batchSize , requestOptions)
269
272
}
270
273
271
274
/** Helper: Deletes every objects for the given objectIDs. The `chunkedBatch` helper is used under the hood, which
@@ -277,6 +280,8 @@ package object extension {
277
280
* The list of objectIDs to delete.
278
281
* @param waitForTasks
279
282
* Whether to wait for the tasks to complete.
283
+ * @param batchSize
284
+ * The size of the batch. Default is 1000.
280
285
* @param requestOptions
281
286
* Additional request configuration.
282
287
* @return
@@ -286,14 +291,15 @@ package object extension {
286
291
indexName : String ,
287
292
objectIDs : Seq [String ],
288
293
waitForTasks : Boolean = false ,
294
+ batchSize : Int = 1000 ,
289
295
requestOptions : Option [RequestOptions ] = None
290
296
)(implicit ec : ExecutionContext ): Future [Seq [BatchResponse ]] = {
291
297
chunkedBatch(
292
298
indexName,
293
299
objectIDs.map(id => new { val objectID : String = id }),
294
300
Action .DeleteObject ,
295
301
waitForTasks,
296
- 1000 ,
302
+ batchSize ,
297
303
requestOptions
298
304
)
299
305
}
@@ -309,6 +315,8 @@ package object extension {
309
315
* To be provided if non-existing objects are passed, otherwise, the call will fail.
310
316
* @param waitForTasks
311
317
* Whether to wait for the tasks to complete.
318
+ * @param batchSize
319
+ * The size of the batch. Default is 1000.
312
320
* @param requestOptions
313
321
* Additional request configuration.
314
322
* @return
@@ -319,14 +327,15 @@ package object extension {
319
327
objects : Seq [Any ],
320
328
createIfNotExists : Boolean = false ,
321
329
waitForTasks : Boolean = false ,
330
+ batchSize : Int = 1000 ,
322
331
requestOptions : Option [RequestOptions ] = None
323
332
)(implicit ec : ExecutionContext ): Future [Seq [BatchResponse ]] = {
324
333
chunkedBatch(
325
334
indexName,
326
335
objects,
327
336
if (createIfNotExists) Action .PartialUpdateObject else Action .PartialUpdateObjectNoCreate ,
328
337
waitForTasks,
329
- 1000 ,
338
+ batchSize ,
330
339
requestOptions
331
340
)
332
341
}
0 commit comments