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

Function batch

packages/client-search/src/searchClient.ts:913–933  ·  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

911 * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
912 */
913 batch({ indexName, batchWriteParams }: BatchProps, requestOptions?: RequestOptions): Promise<BatchResponse> {
914 validateRequired('indexName', 'batch', indexName);
915
916 validateRequired('batchWriteParams', 'batch', batchWriteParams);
917
918 validateRequired('batchWriteParams.requests', 'batch', batchWriteParams.requests);
919
920 const requestPath = '/1/indexes/{indexName}/batch'.replace('{indexName}', encodeURIComponent(indexName));
921 const headers: Headers = {};
922 const queryParameters: QueryParameters = {};
923
924 const request: Request = {
925 method: 'POST',
926 path: requestPath,
927 queryParameters,
928 headers,
929 data: batchWriteParams,
930 };
931
932 return transporter.request(request, requestOptions);
933 },
934
935 /**
936 * Assigns multiple user IDs to a cluster. **You can\'t move users with this operation**.

Callers

nothing calls this directly

Calls 1

validateRequiredFunction · 0.90

Tested by

no test coverage detected