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
import { algoliasearch } from 'algoliasearch';

// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initIngestion({ region: 'us' });

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' },
    ],
  },
});