You're viewing an archived version of our docs. Check out our current documentation →

Push records by task ID

Pushes records through the pipeline, directly to an index. You can make the call synchronous by providing the watch parameter, for asynchronous calls, you can use the observability endpoints or the debugger dashboard to see the status of your task. If you want to transform your data before indexing, this is the recommended way of ingesting your records. This method is similar to push, but requires a taskID instead of a indexName, which is useful when many destinations target the same indexName.

Usage

Required ACL: addObject, deleteIndex, editSettings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Ingestion

let client = try IngestionClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)

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"),
            ]),
        ]
    )
)