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) } }