Create a new Push to Algolia connector
- Go to the Algolia dashboard and select your Algolia .
- On the left sidebar, select Data sources.
- On the Connectors page, select Push to Algolia, then click Connect.
- Configure your transformation: create a new one or reuse an existing one.
- Configure your destination: create a new one or reuse an existing one.
- Create the task to generate a
taskID.
Usage
Update your API client implementation to use either theWithTransformation helper methods of the Search API client
or the pushTask method of the Ingestion API client.
Search API client WithTransformation helper methods
Set up transformation options
Before calling anyWithTransformation method,
set transformationOptions on the search client with your transformation region.
Replace us with eu if your Algolia application uses the Europe analytics region.
You can check your analytics region in the Infrastructure > Analytics section of the Algolia dashboard.
namespace Algolia;
using System;
using System.Collections.Generic;
using Algolia.Search.Clients;
using Algolia.Search.Http;
using Algolia.Search.Models.Search;
class SetUpTransformationOptions
{
async Task Main(string[] args)
{
// Set TransformationOptions with your transformation region to use the `WithTransformation` helper methods.
// Replace "us" with "eu" if your Algolia application uses the Europe analytics region.
var client = SearchClient.WithTransformation(
"ALGOLIA_APPLICATION_ID",
"ALGOLIA_API_KEY",
new TransformationOptions("us")
);
// Save records, transforming them through the Push connector
try
{
var result = await client.SaveObjectsWithTransformationAsync(
"INDEX_NAME",
new List<Object>
{
new Dictionary<string, string> { { "objectID", "1" }, { "name", "Adam" } },
new Dictionary<string, string> { { "objectID", "2" }, { "name", "Benoit" } },
},
true
);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
import 'package:algolia_client_search/algolia_client_search.dart';
void main() async {
// Set transformationOptions with your transformation region to use the `WithTransformation` helper methods.
// Replace 'us' with 'eu' if your Algolia application uses the Europe analytics region.
final client = SearchClient(
appId: 'ALGOLIA_APPLICATION_ID',
apiKey: 'ALGOLIA_API_KEY',
transformationOptions: TransformationOptions(region: 'us'),
);
try {
// Save records, transforming them through the Push connector
await client.saveObjectsWithTransformation(
indexName: "INDEX_NAME",
objects: [
{
'objectID': "1",
'name': "Adam",
},
{
'objectID': "2",
'name': "Benoit",
},
],
waitForTasks: true,
);
print('Done!');
} catch (e) {
print('Error: ${e.toString()}');
}
}
package main
import (
"fmt"
"github.com/algolia/algoliasearch-client-go/v4/algolia/search"
)
func setUpTransformationOptions() {
// Set transformationOptions with your transformation region to use the `WithTransformation` helper methods.
// Replace "us" with "eu" if your Algolia application uses the Europe analytics region.
client, err := search.NewClient(
"ALGOLIA_APPLICATION_ID",
"ALGOLIA_API_KEY",
search.WithTransformationOptions(search.TransformationOptions{Region: "us"}),
)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Save records, transforming them through the Push connector
result, err := client.SaveObjectsWithTransformation(
"INDEX_NAME",
[]map[string]any{{"objectID": "1", "name": "Adam"}, {"objectID": "2", "name": "Benoit"}}, search.WithWaitForTasks(true))
if err != nil {
panic(err)
}
fmt.Printf("Done! Uploaded records in %d batches.", len(result))
}
package com.algolia;
import com.algolia.api.SearchClient;
import com.algolia.config.*;
import com.algolia.model.search.*;
import java.util.Arrays;
import java.util.HashMap;
public class setUpTransformationOptions {
public static void main(String[] args) throws Exception {
// Set `transformationOptions` with your transformation region to use the `WithTransformation`
// helper methods.
// Replace "us" with "eu" if your Algolia application uses the Europe analytics region.
SearchClient client = SearchClient.withTransformation("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", new TransformationOptions("us"));
// Save records, transforming them through the Push connector
client.saveObjectsWithTransformation(
"INDEX_NAME",
Arrays.asList(
new HashMap() {
{
put("objectID", "1");
put("name", "Adam");
}
},
new HashMap() {
{
put("objectID", "2");
put("name", "Benoit");
}
}
),
true
);
client.close();
}
}
import { algoliasearch } from 'algoliasearch';
// Set `transformationOptions` with your transformation region to use the `*WithTransformation` helper methods.
// Replace 'us' with 'eu' if your Algolia application uses the Europe analytics region.
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', {
transformationOptions: { region: 'us' },
});
async function run() {
// Save records, transforming them through the Push connector
const response = await client.saveObjectsWithTransformation({
indexName: 'INDEX_NAME',
objects: [
{ objectID: '1', name: 'Adam' },
{ objectID: '2', name: 'Benoit' },
],
waitForTasks: true,
});
console.log(response);
}
run().catch((err) => console.error(err));
package org.example
import com.algolia.client.api.SearchClient
import com.algolia.client.configuration.*
import com.algolia.client.extensions.*
import com.algolia.client.transport.*
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.buildJsonObject
suspend fun main() {
// Set `transformationOptions` with your transformation region to use the `WithTransformation`
// helper methods.
// Replace "us" with "eu" if your Algolia application uses the Europe analytics region.
val client =
SearchClient.withTransformation(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
transformationOptions = TransformationOptions(region = "us"),
)
try {
// Save records, transforming them through the Push connector
client.saveObjectsWithTransformation(
indexName = "INDEX_NAME",
objects =
listOf(
buildJsonObject {
put("objectID", JsonPrimitive("1"))
put("name", JsonPrimitive("Adam"))
},
buildJsonObject {
put("objectID", JsonPrimitive("2"))
put("name", JsonPrimitive("Benoit"))
},
),
waitForTasks = true,
)
} catch (e: Exception) {
println(e.message)
}
}
<?php
require __DIR__.'/../vendor/autoload.php';
use Algolia\AlgoliaSearch\Api\SearchClient;
use Algolia\AlgoliaSearch\Configuration\SearchConfig;
use Algolia\AlgoliaSearch\Configuration\TransformationOptions;
// Set transformationOptions with your transformation region to use the `WithTransformation` helper methods.
// Replace 'us' with 'eu' if your Algolia application uses the Europe analytics region.
$config = SearchConfig::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');
$config->setTransformationOptions(new TransformationOptions('us'));
$client = SearchClient::createWithConfig($config);
// Save records, transforming them through the Push connector
$client->saveObjectsWithTransformation(
'INDEX_NAME',
[
['objectID' => '1',
'name' => 'Adam',
],
['objectID' => '2',
'name' => 'Benoit',
],
],
true,
);
echo 'Done!';
from algoliasearch.search.client import SearchClientSync
from algoliasearch.search.config import SearchConfig, TransformationOptions
# Set `transformation_options` with your transformation region to use the `*_with_transformation` helper methods.
# Replace "us" with "eu" if your Algolia application uses the Europe analytics region.
_config = SearchConfig(
"ALGOLIA_APPLICATION_ID",
"ALGOLIA_API_KEY",
transformation_options=TransformationOptions(region="us"),
)
_client = SearchClientSync.create_with_config(_config)
# Save records, transforming them through the Push connector
_client.save_objects_with_transformation(
index_name="INDEX_NAME",
objects=[
{
"objectID": "1",
"name": "Adam",
},
{
"objectID": "2",
"name": "Benoit",
},
],
wait_for_tasks=True,
)
require "algolia"
# Set transformation options with your transformation region to use the `*_with_transformation` helper methods.
# Replace 'us' with 'eu' if your Algolia application uses the Europe analytics region.
client = Algolia::SearchClient.with_transformation(
"ALGOLIA_APPLICATION_ID",
"ALGOLIA_API_KEY",
Algolia::TransformationOptions.new("us")
)
# Save records, transforming them through the Push connector
client.save_objects_with_transformation(
"INDEX_NAME",
[{objectID: "1", name: "Adam"}, {objectID: "2", name: "Benoit"}],
true
)
puts("Done!")
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContextExecutor}
import algoliasearch.api.SearchClient
import algoliasearch.config.*
import algoliasearch.extension.SearchClientExtensions
import org.json4s.*
object SetUpTransformationOptions {
def main(args: Array[String]): Unit = {
implicit val ec: ExecutionContextExecutor = scala.concurrent.ExecutionContext.global
// Set transformationOptions with your transformation region to use the `WithTransformation` helper methods.
// Replace "us" with "eu" if your Algolia application uses the Europe analytics region.
val client = SearchClient.withTransformation(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
transformationOptions = TransformationOptions("us")
)
// Save records, transforming them through the Push connector
try {
Await.result(
client.saveObjectsWithTransformation(
indexName = "INDEX_NAME",
objects = Seq(
JObject(List(JField("objectID", JString("1")), JField("name", JString("Adam")))),
JObject(List(JField("objectID", JString("2")), JField("name", JString("Benoit"))))
),
waitForTasks = true
),
Duration(100, "sec")
)
} catch {
case e: Exception => println(e)
}
}
}
import Foundation
#if os(Linux) // For linux interop
import FoundationNetworking
#endif
import AlgoliaCore
import AlgoliaSearch
func setUpTransformationOptions() async throws {
// Set transformationOptions with your transformation region to use the `WithTransformation` helper methods.
// Replace `.us` with `.eu` if your Algolia application uses the Europe analytics region.
let configuration = try SearchClientConfiguration(
appID: "ALGOLIA_APPLICATION_ID",
apiKey: "ALGOLIA_API_KEY",
transformationOptions: TransformationOptions(region: .us)
)
let client = SearchClient(configuration: configuration)
do {
// Save records, transforming them through the Push connector
try await client.saveObjectsWithTransformation(
indexName: "INDEX_NAME",
objects: [["objectID": "1", "name": "Adam"], ["objectID": "2", "name": "Benoit"]],
waitForTasks: true
)
} catch {
print(error.localizedDescription)
}
}
region is required.
The client throws an error if you call a WithTransformation method without setting transformationOptions.
transformationOptions creates a dedicated ingestion transporter that starts from the Ingestion API defaults
(25-second timeouts, hosts derived from your region, and no compression) and only overrides the options you set.
It doesn’t inherit the search client’s configuration.
For more information, see Transformation options and the ingestion transporter.
The WithTransformation helper methods are available for these Algolia API clients:
C#, Dart, Go, Java, JavaScript, Kotlin, PHP, Python, Ruby, Scala, and Swift.
If you target multiple destinations or run several Push connectors, use the pushTask method with a standalone Ingestion API client instead.
transformationOptions replaces the deprecated setTransformationRegion method (Java, C#, PHP),
set_transformation_region method (Python), and transformation option (JavaScript).
Those approaches forwarded the search client’s configuration to the ingestion transporter;
transformationOptions uses the Ingestion API defaults instead.
See your client’s upgrade guide to migrate.These helper methods of the Search API replace the standard API clients methods
(
saveObjects, partialUpdateObjects, replaceAllObjects)
but use the push method of the Ingestion API.
They’re subject to the connector limits.- You already have an existing implementation using an API client.
- You only have created one Push to Algolia connector for the you’re targeting.
WithTransformation helper methods
if you’re using collections and created an additional Push to Algolia connector.
-
Supported:
- 1 Push to Algolia connector and Collections
-
Not supported:
- Multiple Push to Algolia connectors
pushTask method instead.
Save records with transformation
ReplacesaveObjects with saveObjectsWithTransformation.
var response = await client.SaveObjectsWithTransformationAsync(
"INDEX_NAME",
new List<Object>
{
new Dictionary<string, string> { { "objectID", "1" }, { "name", "Adam" } },
new Dictionary<string, string> { { "objectID", "2" }, { "name", "Benoit" } },
},
true
);
final response = await client.saveObjectsWithTransformation(
indexName: "INDEX_NAME",
objects: [
{
'objectID': "1",
'name': "Adam",
},
{
'objectID': "2",
'name': "Benoit",
},
],
waitForTasks: true,
);
response, err := client.SaveObjectsWithTransformation(
"INDEX_NAME",
[]map[string]any{{"objectID": "1", "name": "Adam"}, {"objectID": "2", "name": "Benoit"}}, search.WithWaitForTasks(true))
if err != nil {
// handle the eventual error
panic(err)
}
List response = client.saveObjectsWithTransformation(
"INDEX_NAME",
Arrays.asList(
new HashMap() {
{
put("objectID", "1");
put("name", "Adam");
}
},
new HashMap() {
{
put("objectID", "2");
put("name", "Benoit");
}
}
),
true
);
const response = await client.saveObjectsWithTransformation({
indexName: 'cts_e2e_saveObjectsWithTransformation_javascript',
objects: [
{ objectID: '1', name: 'Adam' },
{ objectID: '2', name: 'Benoit' },
],
waitForTasks: true,
});
var response =
client.saveObjectsWithTransformation(
indexName = "INDEX_NAME",
objects =
listOf(
buildJsonObject {
put("objectID", JsonPrimitive("1"))
put("name", JsonPrimitive("Adam"))
},
buildJsonObject {
put("objectID", JsonPrimitive("2"))
put("name", JsonPrimitive("Benoit"))
},
),
waitForTasks = true,
)
$response = $client->saveObjectsWithTransformation(
'INDEX_NAME',
[
['objectID' => '1',
'name' => 'Adam',
],
['objectID' => '2',
'name' => 'Benoit',
],
],
true,
);
response = client.save_objects_with_transformation(
index_name="INDEX_NAME",
objects=[
{
"objectID": "1",
"name": "Adam",
},
{
"objectID": "2",
"name": "Benoit",
},
],
wait_for_tasks=True,
)
response = client.save_objects_with_transformation(
"INDEX_NAME",
[{objectID: "1", name: "Adam"}, {objectID: "2", name: "Benoit"}],
true
)
val response = Await.result(
client.saveObjectsWithTransformation(
indexName = "INDEX_NAME",
objects = Seq(
JObject(List(JField("objectID", JString("1")), JField("name", JString("Adam")))),
JObject(List(JField("objectID", JString("2")), JField("name", JString("Benoit"))))
),
waitForTasks = true
),
Duration(100, "sec")
)
let response = try await client.saveObjectsWithTransformation(
indexName: "INDEX_NAME",
objects: [["objectID": "1", "name": "Adam"], ["objectID": "2", "name": "Benoit"]],
waitForTasks: true
)
Add or update attributes of multiple records with transformation
ReplacepartialUpdateObjects with partialUpdateObjectsWithTransformation.
var response = await client.PartialUpdateObjectsWithTransformationAsync(
"INDEX_NAME",
new List<Object>
{
new Dictionary<string, string> { { "objectID", "1" }, { "name", "Adam" } },
new Dictionary<string, string> { { "objectID", "2" }, { "name", "Benoit" } },
},
true,
true
);
final response = await client.partialUpdateObjectsWithTransformation(
indexName: "INDEX_NAME",
objects: [
{
'objectID': "1",
'name': "Adam",
},
{
'objectID': "2",
'name': "Benoit",
},
],
createIfNotExists: true,
waitForTasks: true,
);
response, err := client.PartialUpdateObjectsWithTransformation(
"INDEX_NAME",
[]map[string]any{
{"objectID": "1", "name": "Adam"},
{"objectID": "2", "name": "Benoit"},
},
search.WithCreateIfNotExists(true),
search.WithWaitForTasks(true),
)
if err != nil {
// handle the eventual error
panic(err)
}
List response = client.partialUpdateObjectsWithTransformation(
"INDEX_NAME",
Arrays.asList(
new HashMap() {
{
put("objectID", "1");
put("name", "Adam");
}
},
new HashMap() {
{
put("objectID", "2");
put("name", "Benoit");
}
}
),
true,
true
);
const response = await client.partialUpdateObjectsWithTransformation({
indexName: 'cts_e2e_partialUpdateObjectsWithTransformation_javascript',
objects: [
{ objectID: '1', name: 'Adam' },
{ objectID: '2', name: 'Benoit' },
],
createIfNotExists: true,
waitForTasks: true,
});
var response =
client.partialUpdateObjectsWithTransformation(
indexName = "INDEX_NAME",
objects =
listOf(
buildJsonObject {
put("objectID", JsonPrimitive("1"))
put("name", JsonPrimitive("Adam"))
},
buildJsonObject {
put("objectID", JsonPrimitive("2"))
put("name", JsonPrimitive("Benoit"))
},
),
createIfNotExists = true,
waitForTasks = true,
)
$response = $client->partialUpdateObjectsWithTransformation(
'INDEX_NAME',
[
['objectID' => '1',
'name' => 'Adam',
],
['objectID' => '2',
'name' => 'Benoit',
],
],
true,
true,
);
response = client.partial_update_objects_with_transformation(
index_name="INDEX_NAME",
objects=[
{
"objectID": "1",
"name": "Adam",
},
{
"objectID": "2",
"name": "Benoit",
},
],
create_if_not_exists=True,
wait_for_tasks=True,
)
response = client.partial_update_objects_with_transformation(
"INDEX_NAME",
[{objectID: "1", name: "Adam"}, {objectID: "2", name: "Benoit"}],
true,
true
)
val response = Await.result(
client.partialUpdateObjectsWithTransformation(
indexName = "INDEX_NAME",
objects = Seq(
JObject(List(JField("objectID", JString("1")), JField("name", JString("Adam")))),
JObject(List(JField("objectID", JString("2")), JField("name", JString("Benoit"))))
),
createIfNotExists = true,
waitForTasks = true
),
Duration(100, "sec")
)
let response = try await client.partialUpdateObjectsWithTransformation(
indexName: "INDEX_NAME",
objects: [["objectID": "1", "name": "Adam"], ["objectID": "2", "name": "Benoit"]],
createIfNotExists: true,
waitForTasks: true
)
Replace all records with transformation
ReplacereplaceAllObjects with replaceAllObjectsWithTransformation.
var response = await client.ReplaceAllObjectsWithTransformationAsync(
"INDEX_NAME",
new List<Object>
{
new Dictionary<string, string> { { "objectID", "1" }, { "name", "Adam" } },
new Dictionary<string, string> { { "objectID", "2" }, { "name", "Benoit" } },
new Dictionary<string, string> { { "objectID", "3" }, { "name", "Cyril" } },
new Dictionary<string, string> { { "objectID", "4" }, { "name", "David" } },
new Dictionary<string, string> { { "objectID", "5" }, { "name", "Eva" } },
new Dictionary<string, string> { { "objectID", "6" }, { "name", "Fiona" } },
new Dictionary<string, string> { { "objectID", "7" }, { "name", "Gael" } },
new Dictionary<string, string> { { "objectID", "8" }, { "name", "Hugo" } },
new Dictionary<string, string> { { "objectID", "9" }, { "name", "Igor" } },
new Dictionary<string, string> { { "objectID", "10" }, { "name", "Julia" } },
},
3
);
final response = await client.replaceAllObjectsWithTransformation(
indexName: "INDEX_NAME",
objects: [
{
'objectID': "1",
'name': "Adam",
},
{
'objectID': "2",
'name': "Benoit",
},
{
'objectID': "3",
'name': "Cyril",
},
{
'objectID': "4",
'name': "David",
},
{
'objectID': "5",
'name': "Eva",
},
{
'objectID': "6",
'name': "Fiona",
},
{
'objectID': "7",
'name': "Gael",
},
{
'objectID': "8",
'name': "Hugo",
},
{
'objectID': "9",
'name': "Igor",
},
{
'objectID': "10",
'name': "Julia",
},
],
batchSize: 3,
);
response, err := client.ReplaceAllObjectsWithTransformation(
"INDEX_NAME",
[]map[string]any{
{"objectID": "1", "name": "Adam"},
{"objectID": "2", "name": "Benoit"},
{"objectID": "3", "name": "Cyril"},
{"objectID": "4", "name": "David"},
{"objectID": "5", "name": "Eva"},
{"objectID": "6", "name": "Fiona"},
{"objectID": "7", "name": "Gael"},
{"objectID": "8", "name": "Hugo"},
{"objectID": "9", "name": "Igor"},
{"objectID": "10", "name": "Julia"},
},
search.WithBatchSize(3),
)
if err != nil {
// handle the eventual error
panic(err)
}
ReplaceAllObjectsWithTransformationResponse response = client.replaceAllObjectsWithTransformation(
"INDEX_NAME",
Arrays.asList(
new HashMap() {
{
put("objectID", "1");
put("name", "Adam");
}
},
new HashMap() {
{
put("objectID", "2");
put("name", "Benoit");
}
},
new HashMap() {
{
put("objectID", "3");
put("name", "Cyril");
}
},
new HashMap() {
{
put("objectID", "4");
put("name", "David");
}
},
new HashMap() {
{
put("objectID", "5");
put("name", "Eva");
}
},
new HashMap() {
{
put("objectID", "6");
put("name", "Fiona");
}
},
new HashMap() {
{
put("objectID", "7");
put("name", "Gael");
}
},
new HashMap() {
{
put("objectID", "8");
put("name", "Hugo");
}
},
new HashMap() {
{
put("objectID", "9");
put("name", "Igor");
}
},
new HashMap() {
{
put("objectID", "10");
put("name", "Julia");
}
}
),
3
);
const response = await client.replaceAllObjectsWithTransformation({
indexName: 'cts_e2e_replace_all_objects_with_transformation_javascript',
objects: [
{ objectID: '1', name: 'Adam' },
{ objectID: '2', name: 'Benoit' },
{ objectID: '3', name: 'Cyril' },
{ objectID: '4', name: 'David' },
{ objectID: '5', name: 'Eva' },
{ objectID: '6', name: 'Fiona' },
{ objectID: '7', name: 'Gael' },
{ objectID: '8', name: 'Hugo' },
{ objectID: '9', name: 'Igor' },
{ objectID: '10', name: 'Julia' },
],
batchSize: 3,
});
var response =
client.replaceAllObjectsWithTransformation(
indexName = "INDEX_NAME",
objects =
listOf(
buildJsonObject {
put("objectID", JsonPrimitive("1"))
put("name", JsonPrimitive("Adam"))
},
buildJsonObject {
put("objectID", JsonPrimitive("2"))
put("name", JsonPrimitive("Benoit"))
},
buildJsonObject {
put("objectID", JsonPrimitive("3"))
put("name", JsonPrimitive("Cyril"))
},
buildJsonObject {
put("objectID", JsonPrimitive("4"))
put("name", JsonPrimitive("David"))
},
buildJsonObject {
put("objectID", JsonPrimitive("5"))
put("name", JsonPrimitive("Eva"))
},
buildJsonObject {
put("objectID", JsonPrimitive("6"))
put("name", JsonPrimitive("Fiona"))
},
buildJsonObject {
put("objectID", JsonPrimitive("7"))
put("name", JsonPrimitive("Gael"))
},
buildJsonObject {
put("objectID", JsonPrimitive("8"))
put("name", JsonPrimitive("Hugo"))
},
buildJsonObject {
put("objectID", JsonPrimitive("9"))
put("name", JsonPrimitive("Igor"))
},
buildJsonObject {
put("objectID", JsonPrimitive("10"))
put("name", JsonPrimitive("Julia"))
},
),
batchSize = 3,
)
$response = $client->replaceAllObjectsWithTransformation(
'INDEX_NAME',
[
['objectID' => '1',
'name' => 'Adam',
],
['objectID' => '2',
'name' => 'Benoit',
],
['objectID' => '3',
'name' => 'Cyril',
],
['objectID' => '4',
'name' => 'David',
],
['objectID' => '5',
'name' => 'Eva',
],
['objectID' => '6',
'name' => 'Fiona',
],
['objectID' => '7',
'name' => 'Gael',
],
['objectID' => '8',
'name' => 'Hugo',
],
['objectID' => '9',
'name' => 'Igor',
],
['objectID' => '10',
'name' => 'Julia',
],
],
3,
);
response = client.replace_all_objects_with_transformation(
index_name="INDEX_NAME",
objects=[
{
"objectID": "1",
"name": "Adam",
},
{
"objectID": "2",
"name": "Benoit",
},
{
"objectID": "3",
"name": "Cyril",
},
{
"objectID": "4",
"name": "David",
},
{
"objectID": "5",
"name": "Eva",
},
{
"objectID": "6",
"name": "Fiona",
},
{
"objectID": "7",
"name": "Gael",
},
{
"objectID": "8",
"name": "Hugo",
},
{
"objectID": "9",
"name": "Igor",
},
{
"objectID": "10",
"name": "Julia",
},
],
batch_size=3,
)
response = client.replace_all_objects_with_transformation(
"INDEX_NAME",
[
{objectID: "1", name: "Adam"},
{objectID: "2", name: "Benoit"},
{objectID: "3", name: "Cyril"},
{objectID: "4", name: "David"},
{objectID: "5", name: "Eva"},
{objectID: "6", name: "Fiona"},
{objectID: "7", name: "Gael"},
{objectID: "8", name: "Hugo"},
{objectID: "9", name: "Igor"},
{objectID: "10", name: "Julia"}
],
3
)
val response = Await.result(
client.replaceAllObjectsWithTransformation(
indexName = "INDEX_NAME",
objects = Seq(
JObject(List(JField("objectID", JString("1")), JField("name", JString("Adam")))),
JObject(List(JField("objectID", JString("2")), JField("name", JString("Benoit")))),
JObject(List(JField("objectID", JString("3")), JField("name", JString("Cyril")))),
JObject(List(JField("objectID", JString("4")), JField("name", JString("David")))),
JObject(List(JField("objectID", JString("5")), JField("name", JString("Eva")))),
JObject(List(JField("objectID", JString("6")), JField("name", JString("Fiona")))),
JObject(List(JField("objectID", JString("7")), JField("name", JString("Gael")))),
JObject(List(JField("objectID", JString("8")), JField("name", JString("Hugo")))),
JObject(List(JField("objectID", JString("9")), JField("name", JString("Igor")))),
JObject(List(JField("objectID", JString("10")), JField("name", JString("Julia"))))
),
batchSize = 3
),
Duration(100, "sec")
)
let response = try await client.replaceAllObjectsWithTransformation(
indexName: "INDEX_NAME",
objects: [
["objectID": "1", "name": "Adam"],
["objectID": "2", "name": "Benoit"],
["objectID": "3", "name": "Cyril"],
["objectID": "4", "name": "David"],
["objectID": "5", "name": "Eva"],
["objectID": "6", "name": "Fiona"],
["objectID": "7", "name": "Gael"],
["objectID": "8", "name": "Hugo"],
["objectID": "9", "name": "Igor"],
["objectID": "10", "name": "Julia"],
],
batchSize: 3
)
Ingestion API pushTask method
Use the pushTask method of the Ingestion API client if
- You have multiple destinations linked to the index you’re targeting.
- You have multiple Push to Algolia connectors, or a Push to Algolia connector and Collections.
var response = await client.PushTaskAsync(
"6c02aeb1-775e-418e-870b-1faccd4b2c0f",
new PushTaskPayload
{
Action = Enum.Parse<Action>("AddObject"),
Records = new List<PushTaskRecords>
{
new PushTaskRecords
{
ObjectID = "o",
AdditionalProperties = new Dictionary<string, object>
{
{ "key", "bar" },
{ "foo", "1" },
},
},
new PushTaskRecords
{
ObjectID = "k",
AdditionalProperties = new Dictionary<string, object>
{
{ "key", "baz" },
{ "foo", "2" },
},
},
},
}
);
final response = await client.pushTask(
taskID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
pushTaskPayload: PushTaskPayload(
action: Action.fromJson("addObject"),
records: [
PushTaskRecords(
objectID: "o",
additionalProperties: {
'key': "bar",
'foo': "1",
},
),
PushTaskRecords(
objectID: "k",
additionalProperties: {
'key': "baz",
'foo': "2",
},
),
],
),
);
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"),
}),
))
if err != nil {
// handle the eventual error
panic(err)
}
WatchResponse response = client.pushTask(
"6c02aeb1-775e-418e-870b-1faccd4b2c0f",
new PushTaskPayload()
.setAction(Action.ADD_OBJECT)
.setRecords(
Arrays.asList(
new PushTaskRecords().setAdditionalProperty("key", "bar").setAdditionalProperty("foo", "1").setObjectID("o"),
new PushTaskRecords().setAdditionalProperty("key", "baz").setAdditionalProperty("foo", "2").setObjectID("k")
)
)
);
const response = await client.pushTask({
taskID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
pushTaskPayload: {
action: 'addObject',
records: [
{ key: 'bar', foo: '1', objectID: 'o' },
{ key: 'baz', foo: '2', objectID: 'k' },
],
},
});
var response =
client.pushTask(
taskID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
pushTaskPayload =
PushTaskPayload(
action = Action.entries.first { it.value == "addObject" },
records =
listOf(
PushTaskRecords(
objectID = "o",
additionalProperties =
mapOf("key" to JsonPrimitive("bar"), "foo" to JsonPrimitive("1")),
),
PushTaskRecords(
objectID = "k",
additionalProperties =
mapOf("key" to JsonPrimitive("baz"), "foo" to JsonPrimitive("2")),
),
),
),
)
$response = $client->pushTask(
'6c02aeb1-775e-418e-870b-1faccd4b2c0f',
['action' => 'addObject',
'records' => [
['key' => 'bar',
'foo' => '1',
'objectID' => 'o',
],
['key' => 'baz',
'foo' => '2',
'objectID' => 'k',
],
],
],
);
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",
},
],
},
)
response = client.push_task(
"6c02aeb1-775e-418e-870b-1faccd4b2c0f",
Algolia::Ingestion::PushTaskPayload.new(
action: "addObject",
records: [
Algolia::Ingestion::PushTaskRecords.new(key: "bar", foo: "1", algolia_object_id: "o"),
Algolia::Ingestion::PushTaskRecords.new(key: "baz", foo: "2", algolia_object_id: "k")
]
)
)
val response = Await.result(
client.pushTask(
taskID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
pushTaskPayload = PushTaskPayload(
action = Action.withName("addObject"),
records = Seq(
PushTaskRecords(
objectID = "o",
additionalProperties = Some(List(JField("key", JString("bar")), JField("foo", JString("1"))))
),
PushTaskRecords(
objectID = "k",
additionalProperties = Some(List(JField("key", JString("baz")), JField("foo", JString("2"))))
)
)
)
),
Duration(100, "sec")
)
let response = try await client.pushTask(
taskID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
pushTaskPayload: PushTaskPayload(
action: IngestionAction.addObject,
records: [
PushTaskRecords(from: [
"objectID": AnyCodable("o"),
"key": AnyCodable("bar"),
"foo": AnyCodable("1"),
]),
PushTaskRecords(from: [
"objectID": AnyCodable("k"),
"key": AnyCodable("baz"),
"foo": AnyCodable("2"),
]),
]
)
)
Performance considerations
If you don’t need an Algolia-managed transformation, send records in batches using the regular API client methods to avoid processing overhead.Supported indexing actions
The Push to Algolia connector supports allaction types for batch indexing operations.
For deleteObject, delete, and clear actions,
it skips the transformation and uses traditional indexing instead.
Connector Debugger
To check and debugpushTask operations:
- Check incoming events in the Connector Debugger on the Algolia dashboard.
The
eventIDreturned by a successfulpushTaskAPI call shows the status of the indexing operation. - To get real-time feedback, add the
watchparameter to thepushTaskAPI call. The response body reports errors and successes.