From f50d51f10712d332b42b1db3a65f8e14cbd89a20 Mon Sep 17 00:00:00 2001 From: Mikko Kauhanen Date: Tue, 10 Dec 2024 07:51:01 +0200 Subject: [PATCH] Change refresh=wait_for to false as opensearch serverless does not support it --- aoe-web-backend/src/search/es.ts | 4 ++-- aoe-web-backend/src/search/esCollection.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aoe-web-backend/src/search/es.ts b/aoe-web-backend/src/search/es.ts index 4d8b0483b..998bc000a 100644 --- a/aoe-web-backend/src/search/es.ts +++ b/aoe-web-backend/src/search/es.ts @@ -272,7 +272,7 @@ export async function metadataToEs(offset: number, limit: number) { const body = data.flatMap(doc => [{ index: { _index: index, _id: doc.id } }, doc]); // winstonLogger.debug("THIS IS BODY:"); // winstonLogger.debug(JSON.stringify(body)); - const { body: bulkResponse } = await client.bulk({ refresh: true, body }); + const { body: bulkResponse } = await client.bulk({ refresh: false, body }); if (bulkResponse.errors) { const erroredDocuments = []; // The items array has the same order of the dataset we just indexed. @@ -454,7 +454,7 @@ export const updateEsDocument = (updateCounters?: boolean): Promise => { .then(async (data: any) => { // #1 then start if (data.length > 0) { const body = data.flatMap(doc => [{ index: { _index: index, _id: doc.id } }, doc]); - const { body: bulkResponse } = await client.bulk({ refresh: true, body }); + const { body: bulkResponse } = await client.bulk({ refresh: false, body }); if (bulkResponse.errors) { winstonLogger.error('Bulk response error: %o', bulkResponse.errors); } else { diff --git a/aoe-web-backend/src/search/esCollection.ts b/aoe-web-backend/src/search/esCollection.ts index cce01b888..7e0c69f41 100644 --- a/aoe-web-backend/src/search/esCollection.ts +++ b/aoe-web-backend/src/search/esCollection.ts @@ -153,7 +153,7 @@ export async function collectionDataToEs(index: string, data: any) { const body = data.flatMap(doc => [{ index: { _index: index, _id: doc.id } }, doc]); // winstonLogger.debug("THIS IS BODY:"); // winstonLogger.debug(JSON.stringify(body)); - const { body: bulkResponse } = await client.bulk({ refresh: true, body }); + const { body: bulkResponse } = await client.bulk({ refresh: false, body }); if (bulkResponse.errors) { const erroredDocuments = []; // The items array has the same order of the dataset we just indexed.