From 26129086be7a97595fdbe030b323e4f3ab1f1054 Mon Sep 17 00:00:00 2001 From: Markus Date: Thu, 25 Jul 2024 09:33:17 +0300 Subject: [PATCH] chore(elastic-upgrade): remove accidental nesting of must bools --- .../registration/deduplicate/service.ts | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/packages/search/src/features/registration/deduplicate/service.ts b/packages/search/src/features/registration/deduplicate/service.ts index 8b2e30da4cd..7c1b0200746 100644 --- a/packages/search/src/features/registration/deduplicate/service.ts +++ b/packages/search/src/features/registration/deduplicate/service.ts @@ -153,29 +153,25 @@ export const searchForBirthDuplicates = async ( const childsNameMatch = { bool: { - must: { - bool: { - must: [ - body.childFirstNames && { - match: { - childFirstNames: { - query: body.childFirstNames, - fuzziness: FIRST_NAME_FUZZINESS - } - } - }, - body.childFamilyName && { - match: { - childFamilyName: { - query: body.childFamilyName, - fuzziness: FIRST_NAME_FUZZINESS, - minimum_should_match: '100%' - } - } + must: [ + body.childFirstNames && { + match: { + childFirstNames: { + query: body.childFirstNames, + fuzziness: FIRST_NAME_FUZZINESS + } + } + }, + body.childFamilyName && { + match: { + childFamilyName: { + query: body.childFamilyName, + fuzziness: FIRST_NAME_FUZZINESS, + minimum_should_match: '100%' } - ].filter(isNonEmptyCondition) + } } - } + ].filter(isNonEmptyCondition) } }