Split records into batches and push them through the transformation pipeline.
Required ACL:addObject, deleteIndex, editSettingsUse chunkedPush to push a large number of records to an index
through the transformation pipeline.This helper method splits your records into batches (1,000 records by default)
and sends each batch as a push request.
This lets you index large datasets without worrying about request size limits.To use this method, you need a Push to Algolia connector.The Search API client helpers,
such as saveObjectsWithTransformation
and replaceAllObjectsWithTransformation,
use chunkedPush internally.
Use chunkedPush directly on the Ingestion client if you need more control
over the indexing action or batch size.This method is subject to connector limits.
// Initialize the clientvar client = new IngestionClient( new IngestionConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"));// Records to pushvar objects = new List<object>{ new { objectID = "1", name = "Record 1" }, new { objectID = "2", name = "Record 2" },};// Push records in batchesvar responses = await client.ChunkedPushAsync( "INDEX_NAME", objects, Action.AddObject, waitForTasks: true, batchSize: 1000);
// Initialize the client with your application region, e.g., ingestion.USclient, err := ingestion.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", ingestion.US)if err != nil { panic(err)}// Records to pushobjects := []map[string]any{ {"objectID": "1", "name": "Record 1"}, {"objectID": "2", "name": "Record 2"},}// Push records in batchesresponses, err := client.ChunkedPush( "INDEX_NAME", objects, ingestion.ActionAddObject, nil, // referenceIndexName ingestion.WithWaitForTasks(true), ingestion.WithBatchSize(1000),)
// Initialize the clientIngestionClient client = new IngestionClient( "ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");// Records to pushList<Object> objects = Arrays.asList( Map.of("objectID", "1", "name", "Record 1"), Map.of("objectID", "2", "name", "Record 2"));// Push records in batchesList<WatchResponse> responses = client.chunkedPush( "INDEX_NAME", objects, Action.ADD_OBJECT, true, // waitForTasks 1000, // batchSize null, // referenceIndexName null // requestOptions);
import { ingestionClient } from "@algolia/client-ingestion";// Initialize the clientconst client = ingestionClient( "ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");// Records to pushconst objects = [ { objectID: "1", name: "Record 1" }, { objectID: "2", name: "Record 2" },];// Push records in batchesconst responses = await client.chunkedPush({ indexName: "INDEX_NAME", objects, action: "addObject", waitForTasks: true,});
// Initialize the client$client = IngestionClient::create( 'ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');// Records to push$objects = [ ['objectID' => '1', 'name' => 'Record 1'], ['objectID' => '2', 'name' => 'Record 2'],];// Push records in batches$responses = $client->chunkedPush( 'INDEX_NAME', $objects, 'addObject', true, // waitForTasks 1000 // batchSize);
from algoliasearch.ingestion.client import IngestionClientSyncfrom algoliasearch.ingestion.models.action import Action# Initialize the client# In an asynchronous context, use IngestionClient instead.client = IngestionClientSync( "ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")# Records to pushobjects = [ {"objectID": "1", "name": "Record 1"}, {"objectID": "2", "name": "Record 2"},]# Push records in batchesresponses = client.chunked_push( index_name="INDEX_NAME", objects=objects, action=Action.ADDOBJECT, wait_for_tasks=True,)