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 Connector supports every batch action. For the deleteObject, delete and clear actions, the Connector skips the transformation and uses the traditional indexing instead.
Debugging
You can debug and track the progress of your push operations by:
Observing the incoming events in the Connector Debugger page of the Algolia dashboard.