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