From d5ef314dec9b31e2c131cc95cc5e91b6fdfd105b Mon Sep 17 00:00:00 2001 From: Uros Marolt Date: Fri, 18 Aug 2023 17:17:06 +0200 Subject: [PATCH] add location to opensearch organization index document (#1360) --- .../src/service/opensearch.service.ts | 11 ++++++++++- .../src/service/organization.sync.service.ts | 1 + services/libs/opensearch/src/models/organizations.ts | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/services/apps/search_sync_worker/src/service/opensearch.service.ts b/services/apps/search_sync_worker/src/service/opensearch.service.ts index df45a59b01..068aa18b5b 100644 --- a/services/apps/search_sync_worker/src/service/opensearch.service.ts +++ b/services/apps/search_sync_worker/src/service/opensearch.service.ts @@ -157,7 +157,16 @@ export class OpenSearchService extends LoggerBase { }) if (result.body.errors === true) { - this.log.error({ errorItems: result.body.items }, 'Failed to bulk index documents!') + const errorItems = result.body.items + .filter((i) => i.index !== undefined && i.index.error !== undefined) + .map((i) => { + return { + error: i.index.error, + itemId: i.index._id, + } + }) + + this.log.error({ errorItems }, 'Failed to bulk index documents!') throw new Error(`Failed to bulk index documents in index ${index}!`) } } catch (err) { diff --git a/services/apps/search_sync_worker/src/service/organization.sync.service.ts b/services/apps/search_sync_worker/src/service/organization.sync.service.ts index fb1424201b..7d676376bb 100644 --- a/services/apps/search_sync_worker/src/service/organization.sync.service.ts +++ b/services/apps/search_sync_worker/src/service/organization.sync.service.ts @@ -440,6 +440,7 @@ export class OrganizationSyncService extends LoggerBase { p.int_employees = data.employees p.int_founded = data.founded p.string_geoLocation = data.geoLocation + p.string_location = data.location p.string_headline = data.headline p.keyword_importHash = data.importHash p.string_industry = data.industry diff --git a/services/libs/opensearch/src/models/organizations.ts b/services/libs/opensearch/src/models/organizations.ts index 9431268a2a..d362ca958b 100644 --- a/services/libs/opensearch/src/models/organizations.ts +++ b/services/libs/opensearch/src/models/organizations.ts @@ -50,6 +50,9 @@ export class OrganizationsOpensearch extends OpensearchModelBase { geoLocation: { type: OpensearchFieldType.STRING, }, + location: { + type: OpensearchFieldType.STRING, + }, headline: { type: OpensearchFieldType.STRING, },