@@ -371,6 +371,7 @@ public suspend fun SearchClient.chunkedBatch(
371
371
* @param indexName The index in which to perform the request.
372
372
* @param objects The list of objects to index.
373
373
* @param waitForTask If true, wait for the task to complete.
374
+ * @param batchSize The size of the batch. Default is 1000.
374
375
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
375
376
* @return The list of responses from the batch requests.
376
377
*
@@ -379,14 +380,15 @@ public suspend fun SearchClient.saveObjects(
379
380
indexName : String ,
380
381
objects : List <JsonObject >,
381
382
waitForTask : Boolean = false,
383
+ batchSize : Int = 1000,
382
384
requestOptions : RequestOptions ? = null,
383
385
): List <BatchResponse > {
384
386
return this .chunkedBatch(
385
387
indexName = indexName,
386
388
objects = objects,
387
389
action = Action .AddObject ,
388
390
waitForTask = waitForTask,
389
- batchSize = 1000 ,
391
+ batchSize = batchSize ,
390
392
requestOptions = requestOptions,
391
393
)
392
394
}
@@ -397,6 +399,7 @@ public suspend fun SearchClient.saveObjects(
397
399
* @param indexName The index in which to perform the request.
398
400
* @param objectIDs The list of objectIDs to delete from the index.
399
401
* @param waitForTask If true, wait for the task to complete.
402
+ * @param batchSize The size of the batch. Default is 1000.
400
403
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
401
404
* @return The list of responses from the batch requests.
402
405
*
@@ -405,14 +408,15 @@ public suspend fun SearchClient.deleteObjects(
405
408
indexName : String ,
406
409
objectIDs : List <String >,
407
410
waitForTask : Boolean = false,
411
+ batchSize : Int = 1000,
408
412
requestOptions : RequestOptions ? = null,
409
413
): List <BatchResponse > {
410
414
return this .chunkedBatch(
411
415
indexName = indexName,
412
416
objects = objectIDs.map { id -> JsonObject (mapOf (" objectID" to Json .encodeToJsonElement(id))) },
413
417
action = Action .DeleteObject ,
414
418
waitForTask = waitForTask,
415
- batchSize = 1000 ,
419
+ batchSize = batchSize ,
416
420
requestOptions = requestOptions,
417
421
)
418
422
}
@@ -424,6 +428,7 @@ public suspend fun SearchClient.deleteObjects(
424
428
* @param objects The list of objects to update in the index.
425
429
* @param createIfNotExists To be provided if non-existing objects are passed, otherwise, the call will fail..
426
430
* @param waitForTask If true, wait for the task to complete.
431
+ * @param batchSize The size of the batch. Default is 1000.
427
432
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
428
433
* @return The list of responses from the batch requests.
429
434
*
@@ -433,14 +438,15 @@ public suspend fun SearchClient.partialUpdateObjects(
433
438
objects : List <JsonObject >,
434
439
createIfNotExists : Boolean ,
435
440
waitForTask : Boolean = false,
441
+ batchSize : Int = 1000,
436
442
requestOptions : RequestOptions ? = null,
437
443
): List <BatchResponse > {
438
444
return this .chunkedBatch(
439
445
indexName = indexName,
440
446
objects = objects,
441
447
action = if (createIfNotExists) Action .PartialUpdateObject else Action .PartialUpdateObjectNoCreate ,
442
448
waitForTask = waitForTask,
443
- batchSize = 1000 ,
449
+ batchSize = batchSize ,
444
450
requestOptions = requestOptions,
445
451
)
446
452
}
0 commit comments