> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add or update attributes of multiple records with transformation

> Add or update record attributes without replacing the entire record, using the transformation pipeline.

**Required ACL:** `addObject`

Before using this method, [set up the transformation region](/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push#set-up-the-transformation-region) on the search client.

To use this method, you must have only one [Push to Algolia](/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push) connector.
The API returns a `400` error if you have more than one Push connector,
or you use [Collections](/doc/guides/solutions/ecommerce/browse/tutorials/collections) *and* a Push connector.

For more information, see [`WithTransformation` helper methods](/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push#search-api-client-withtransformation-helper-methods).

This helper method creates a [push task](/doc/rest-api/ingestion/push) with the `partialUpdateObject` or `partialUpdateObjectNoCreate` actions, depending on whether the `createIfNotExists` option is `true` or `false`.
Requests are sent in batches of 1,000 records.

This method is subject to [indexing rate limits](https://support.algolia.com/hc/en-us/articles/4406975251089-Is-there-a-rate-limit-for-indexing-on-Algolia) and [connector limits](/doc/guides/scaling/algolia-service-limits#connectors-limits).

<Note>
  If you use this method to update records in a [collection](/doc/guides/solutions/ecommerce/browse/tutorials/collections), **include all attributes referenced in the collection's conditions**. Even though this method uses partial updates, conditions are re-evaluated whenever the records update. Missing attributes can prevent records from [matching the collection's conditions](/doc/guides/solutions/ecommerce/browse/tutorials/collections#a-collection-isn-t-showing-up).
</Note>

## Usage

<CodeGroup>
  ```cs C# theme={"system"}
  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
  );
  ```

  ```dart Dart theme={"system"}
  final response = await client.partialUpdateObjectsWithTransformation(
    indexName: "INDEX_NAME",
    objects: [
      {
        'objectID': "1",
        'name': "Adam",
      },
      {
        'objectID': "2",
        'name': "Benoit",
      },
    ],
    createIfNotExists: true,
    waitForTasks: true,
  );
  ```

  ```go Go theme={"system"}
  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)
  }
  ```

  ```java Java theme={"system"}
  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
  );
  ```

  ```js JavaScript theme={"system"}
  const response = await client.partialUpdateObjectsWithTransformation({
    indexName: 'cts_e2e_partialUpdateObjectsWithTransformation_javascript',
    objects: [
      { objectID: '1', name: 'Adam' },
      { objectID: '2', name: 'Benoit' },
    ],
    createIfNotExists: true,
    waitForTasks: true,
  });
  ```

  ```kotlin Kotlin theme={"system"}
  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,
    )
  ```

  ```php PHP theme={"system"}
  $response = $client->partialUpdateObjectsWithTransformation(
      'INDEX_NAME',
      [
          ['objectID' => '1',
              'name' => 'Adam',
          ],

          ['objectID' => '2',
              'name' => 'Benoit',
          ],
      ],
      true,
      true,
  );
  ```

  ```python Python theme={"system"}
  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,
  )
  ```

  ```ruby Ruby theme={"system"}
  response = client.partial_update_objects_with_transformation(
    "INDEX_NAME",
    [{objectID: "1", name: "Adam"}, {objectID: "2", name: "Benoit"}],
    true,
    true
  )
  ```

  ```scala Scala theme={"system"}
  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")
  )
  ```

  ```swift Swift theme={"system"}
  let response = try await client.partialUpdateObjectsWithTransformation(
      indexName: "INDEX_NAME",
      objects: [["objectID": "1", "name": "Adam"], ["objectID": "2", "name": "Benoit"]],
      createIfNotExists: true,
      waitForTasks: true
  )
  ```
</CodeGroup>

## Parameters

<Tabs>
  <Tab title="Go">
    <ParamField body="indexName" type="string" required>
      Name of the index to update records in.
    </ParamField>

    <ParamField body="objects" type="[]map[string]any" required>
      Records to update.
    </ParamField>

    <ParamField body="opts..." type="PartialUpdateObjectsOption">
      Functional options to provide extra arguments.

      <Expandable title="available functions">
        <ParamField body="search.WithCreateIfNotExists" type="function">
          **Signature:** `func(createIfNotExists bool) partialUpdateObjectsOption`

          Whether to add new records to the index if they don't exist yet.
          By default, this function returns `true`.
        </ParamField>

        <ParamField body="search.WithBatchSize" type="function">
          **Signature:** `func(batchSize int) chunkedBatchOption`

          Sets the number of records to process in one batch.
          The default batch size is 1,000.
        </ParamField>

        <ParamField body="search.WithWaitForTasks" type="function">
          **Signature:** `func(withWaitForTasks bool) chunkedBatchOption`

          Whether to wait until all batch requests are done.
        </ParamField>

        <ParamField body="search.WithHeaderParam" type="function">
          **Signature:** `func(key string, value string) requestOption`

          Sets extra header parameters for this request.
          To learn more, see [request options](/doc/libraries/sdk/request-options).
        </ParamField>

        <ParamField body="search.WithQueryParam" type="function">
          **Signature:** `func(key string, value string) requestOption`

          Sets extra query parameters for this request.
          To learn more, see [request options](/doc/libraries/sdk/request-options).
        </ParamField>
      </Expandable>
    </ParamField>
  </Tab>

  <Tab title="Java">
    <ParamField body="indexName" type="String" required>
      Name of the index to update records in.
    </ParamField>

    <ParamField body="objects" type="Iterable<T>" required>
      Records to update.
    </ParamField>

    <ParamField body="T" type="Type parameter" required>
      The model of your index's records.
    </ParamField>

    <ParamField body="createIfNotExists" type="boolean" required>
      Whether to add new records to the index if they don't exist yet.
    </ParamField>

    <ParamField body="waitForTasks" type="boolean" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="JavaScript">
    <ParamField body="indexName" type="string" required>
      Name of the index to update records in.
    </ParamField>

    <ParamField body="objects" type="Record<string,unknown>[]" required>
      Records to update.
    </ParamField>

    <ParamField body="createIfNotExists" type="boolean" default="undefined">
      Whether to add new records to the index if they don't exist yet.
    </ParamField>

    <ParamField body="waitForTasks" type="boolean" default={false}>
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="requestOptions" type="RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="PHP">
    <ParamField body="indexName" type="string" required>
      Name of the index to update records in.
    </ParamField>

    <ParamField body="objects" type="array" required>
      Records to update.
    </ParamField>

    <ParamField body="createIfNotExists" type="bool" required>
      Whether to add new records to the index if they don't exist yet.
    </ParamField>

    <ParamField body="requestOptions" type="array">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>

  <Tab title="Python">
    <ParamField body="index_name" type="str" required>
      Name of the index to update records in.
    </ParamField>

    <ParamField body="objects" type="list[dict]" required>
      Records to update.
    </ParamField>

    <ParamField body="create_if_not_exists" type="bool" default="False">
      Whether to add new records to the index if they don't exist yet.
    </ParamField>

    <ParamField body="wait_for_task" type="bool" default="False">
      Whether to wait until all batch requests are done.
    </ParamField>

    <ParamField body="request_options" type="dict | RequestOptions">
      Additional [request options](/doc/libraries/sdk/request-options).
    </ParamField>
  </Tab>
</Tabs>
