import"github.com/algolia/algoliasearch-client-go/v4/algolia/ingestion"client,err:=ingestion.NewClient("ALGOLIA_APPLICATION_ID","ALGOLIA_API_KEY",ingestion.US)iferr!=nil{// The client can fail to initialize if you pass an invalid parameter.panic(err)}response,err:=client.PushTask(client.NewApiPushTaskRequest("6c02aeb1-775e-418e-870b-1faccd4b2c0f",ingestion.NewEmptyPushTaskPayload().SetAction(ingestion.Action("addObject")).SetRecords([]ingestion.PushTaskRecords{*ingestion.NewEmptyPushTaskRecords().SetAdditionalProperty("key","bar").SetAdditionalProperty("foo","1").SetObjectID("o"),*ingestion.NewEmptyPushTaskRecords().SetAdditionalProperty("key","baz").SetAdditionalProperty("foo","2").SetObjectID("k")})))iferr!=nil{// handle the eventual errorpanic(err)}
import{algoliasearch}from'algoliasearch';// Replace 'us' with your Algolia Application Regionconstclient=algoliasearch('ALGOLIA_APPLICATION_ID','ALGOLIA_API_KEY').initIngestion({region:'us'});constresponse=awaitclient.pushTask({taskID:'6c02aeb1-775e-418e-870b-1faccd4b2c0f',pushTaskPayload:{action:'addObject',records:[{key:'bar',foo:'1',objectID:'o'},{key:'baz',foo:'2',objectID:'k'},],},});
fromalgoliasearch.ingestion.clientimportIngestionClientSyncfromjsonimportloads# In an asynchronous context, you can use IngestionClient instead, which exposes the exact same methods.
client=IngestionClientSync("ALGOLIA_APPLICATION_ID","ALGOLIA_API_KEY","ALGOLIA_APPLICATION_REGION")response=client.push_task(task_id="6c02aeb1-775e-418e-870b-1faccd4b2c0f",push_task_payload={"action":"addObject","records":[{"key":"bar","foo":"1","objectID":"o",},{"key":"baz","foo":"2","objectID":"k",},],},)
The Push to Algolia connector supports all action types for batch indexing operations.
For deleteObject, delete and clear actions,
it skips the transformation and uses traditional indexing.
Connector Debugger
To check and debug pushTask operations:
Check incoming events in the Connector Debugger on the Algolia dashboard.
The eventID returned by a successful pushTask API call shows the status of the indexing operation.
To get real-time feedback, add the watch parameter to the pushTask API call. The response body reports errors and successes.