MCPcopy Create free account
hub / github.com/algolia/algoliasearch-client-javascript / batch

Function batch

packages/client-search/src/searchClient.ts:1093–1113  ·  view source on GitHub ↗

* Adds, updates, or deletes records in one index with a single API request. Batching index updates reduces latency and increases data integrity. - Actions are applied in the order they\'re specified. - Actions are equivalent to the individual API requests of the same name. This operation is subje

({ indexName, batchWriteParams }: BatchProps, requestOptions?: RequestOptions)

Source from the content-addressed store, hash-verified

1091 * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1092 */
1093 batch({ indexName, batchWriteParams }: BatchProps, requestOptions?: RequestOptions): Promise<BatchResponse> {
1094 validateRequired('indexName', 'batch', indexName);
1095
1096 validateRequired('batchWriteParams', 'batch', batchWriteParams);
1097
1098 validateRequired('batchWriteParams.requests', 'batch', batchWriteParams.requests);
1099
1100 const requestPath = '/1/indexes/{indexName}/batch'.replace('{indexName}', encodeURIComponent(indexName));
1101 const headers: Headers = {};
1102 const queryParameters: QueryParameters = {};
1103
1104 const request: Request = {
1105 method: 'POST',
1106 path: requestPath,
1107 queryParameters,
1108 headers,
1109 data: batchWriteParams,
1110 };
1111
1112 return transporter.request(request, requestOptions);
1113 },
1114 /**
1115 * Adds, updates, or deletes records in one index with a single API request. Batching index updates reduces latency and increases data integrity. - Actions are applied in the order they\'re specified. - Actions are equivalent to the individual API requests of the same name. This operation is subject to [indexing rate limits](https://support.algolia.com/hc/articles/4406975251089-Is-there-a-rate-limit-for-indexing-on-Algolia).
1116 *

Callers

nothing calls this directly

Calls 1

validateRequiredFunction · 0.90

Tested by

no test coverage detected