* 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 and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data
(
{ indexName, pushTaskPayload, watch, referenceIndexName }: PushProps,
requestOptions?: RequestOptions,
)
| 3278 | * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. |
| 3279 | */ |
| 3280 | push( |
| 3281 | { indexName, pushTaskPayload, watch, referenceIndexName }: PushProps, |
| 3282 | requestOptions?: RequestOptions, |
| 3283 | ): Promise<WatchResponse> { |
| 3284 | validateRequired('indexName', 'push', indexName); |
| 3285 | |
| 3286 | validateRequired('pushTaskPayload', 'push', pushTaskPayload); |
| 3287 | |
| 3288 | validateRequired('pushTaskPayload.action', 'push', pushTaskPayload.action); |
| 3289 | validateRequired('pushTaskPayload.records', 'push', pushTaskPayload.records); |
| 3290 | |
| 3291 | const requestPath = '/1/push/{indexName}'.replace('{indexName}', encodeURIComponent(indexName)); |
| 3292 | const headers: Headers = {}; |
| 3293 | const queryParameters: QueryParameters = {}; |
| 3294 | |
| 3295 | if (watch !== undefined) { |
| 3296 | queryParameters['watch'] = watch.toString(); |
| 3297 | } |
| 3298 | |
| 3299 | if (referenceIndexName !== undefined) { |
| 3300 | queryParameters['referenceIndexName'] = referenceIndexName.toString(); |
| 3301 | } |
| 3302 | |
| 3303 | const request: Request = { |
| 3304 | method: 'POST', |
| 3305 | path: requestPath, |
| 3306 | queryParameters, |
| 3307 | headers, |
| 3308 | data: pushTaskPayload, |
| 3309 | }; |
| 3310 | |
| 3311 | requestOptions = { |
| 3312 | ...requestOptions, |
| 3313 | timeouts: { |
| 3314 | connect: 180000, |
| 3315 | read: 180000, |
| 3316 | write: 180000, |
| 3317 | ...requestOptions?.timeouts, |
| 3318 | }, |
| 3319 | }; |
| 3320 | |
| 3321 | return transporter.request(request, requestOptions); |
| 3322 | }, |
| 3323 | /** |
| 3324 | * 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 and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data), this is the recommended way of ingesting your records. This method is similar to `pushTask`, but requires an `indexName` instead of a `taskID`. If zero or many tasks are found, an error will be returned. |
| 3325 | * |
nothing calls this directly
no test coverage detected