@@ -568,43 +568,45 @@ public List<BatchResponse> ChunkedBatch<T>(string indexName, IEnumerable<T> obje
568568 /// <inheritdoc/>
569569 public async Task < List < BatchResponse > > SaveObjectsAsync < T > ( string indexName , IEnumerable < T > objects ,
570570 bool waitForTasks = false ,
571+ int batchSize = 1000 ,
571572 RequestOptions options = null ,
572573 CancellationToken cancellationToken = default ) where T : class
573574 {
574- return await ChunkedBatchAsync ( indexName , objects , Action . AddObject , waitForTasks , 1000 , options , cancellationToken ) . ConfigureAwait ( false ) ;
575+ return await ChunkedBatchAsync ( indexName , objects , Action . AddObject , waitForTasks , batchSize , options , cancellationToken ) . ConfigureAwait ( false ) ;
575576 }
576577
577578 /// <inheritdoc/>
578- public List < BatchResponse > SaveObjects < T > ( string indexName , IEnumerable < T > objects , bool waitForTasks = false , RequestOptions options = null ,
579+ public List < BatchResponse > SaveObjects < T > ( string indexName , IEnumerable < T > objects , bool waitForTasks = false , int batchSize = 1000 , RequestOptions options = null ,
579580 CancellationToken cancellationToken = default ) where T : class =>
580- AsyncHelper . RunSync ( ( ) => SaveObjectsAsync ( indexName , objects , waitForTasks , options , cancellationToken ) ) ;
581+ AsyncHelper . RunSync ( ( ) => SaveObjectsAsync ( indexName , objects , waitForTasks , batchSize , options , cancellationToken ) ) ;
581582
582583 /// <inheritdoc/>
583584 public async Task < List < BatchResponse > > DeleteObjectsAsync ( string indexName , IEnumerable < String > objectIDs ,
584585 bool waitForTasks = false ,
586+ int batchSize = 1000 ,
585587 RequestOptions options = null ,
586588 CancellationToken cancellationToken = default )
587589 {
588- return await ChunkedBatchAsync ( indexName , objectIDs . Select ( id => new { objectID = id } ) , Action . DeleteObject , waitForTasks , 1000 , options , cancellationToken ) . ConfigureAwait ( false ) ;
590+ return await ChunkedBatchAsync ( indexName , objectIDs . Select ( id => new { objectID = id } ) , Action . DeleteObject , waitForTasks , batchSize , options , cancellationToken ) . ConfigureAwait ( false ) ;
589591 }
590592
591593 /// <inheritdoc/>
592- public List < BatchResponse > DeleteObjects ( string indexName , IEnumerable < String > objectIDs , bool waitForTasks = false , RequestOptions options = null ,
594+ public List < BatchResponse > DeleteObjects ( string indexName , IEnumerable < String > objectIDs , bool waitForTasks = false , int batchSize = 1000 , RequestOptions options = null ,
593595 CancellationToken cancellationToken = default ) =>
594- AsyncHelper . RunSync ( ( ) => DeleteObjectsAsync ( indexName , objectIDs , waitForTasks , options , cancellationToken ) ) ;
596+ AsyncHelper . RunSync ( ( ) => DeleteObjectsAsync ( indexName , objectIDs , waitForTasks , batchSize , options , cancellationToken ) ) ;
595597
596598 /// <inheritdoc/>
597- public async Task < List < BatchResponse > > PartialUpdateObjectsAsync < T > ( string indexName , IEnumerable < T > objects , bool createIfNotExists , bool waitForTasks = false ,
599+ public async Task < List < BatchResponse > > PartialUpdateObjectsAsync < T > ( string indexName , IEnumerable < T > objects , bool createIfNotExists , bool waitForTasks = false , int batchSize = 1000 ,
598600 RequestOptions options = null ,
599601 CancellationToken cancellationToken = default ) where T : class
600602 {
601- return await ChunkedBatchAsync ( indexName , objects , createIfNotExists ? Action . PartialUpdateObject : Action . PartialUpdateObjectNoCreate , waitForTasks , 1000 , options , cancellationToken ) . ConfigureAwait ( false ) ;
603+ return await ChunkedBatchAsync ( indexName , objects , createIfNotExists ? Action . PartialUpdateObject : Action . PartialUpdateObjectNoCreate , waitForTasks , batchSize , options , cancellationToken ) . ConfigureAwait ( false ) ;
602604 }
603605
604606 /// <inheritdoc/>
605- public List < BatchResponse > PartialUpdateObjects < T > ( string indexName , IEnumerable < T > objects , bool createIfNotExists , bool waitForTasks = false ,
607+ public List < BatchResponse > PartialUpdateObjects < T > ( string indexName , IEnumerable < T > objects , bool createIfNotExists , bool waitForTasks = false , int batchSize = 1000 ,
606608 RequestOptions options = null , CancellationToken cancellationToken = default ) where T : class =>
607- AsyncHelper . RunSync ( ( ) => PartialUpdateObjectsAsync ( indexName , objects , createIfNotExists , waitForTasks , options , cancellationToken ) ) ;
609+ AsyncHelper . RunSync ( ( ) => PartialUpdateObjectsAsync ( indexName , objects , createIfNotExists , waitForTasks , batchSize , options , cancellationToken ) ) ;
608610
609611 private static async Task < List < TU > > CreateIterable < TU > ( Func < TU , Task < TU > > executeQuery ,
610612 Func < TU , bool > stopCondition )
0 commit comments