From 9777b052c879d27947f42cc17dbd7223264e68ed Mon Sep 17 00:00:00 2001 From: 07Himank <112613760+07Himank@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:32:43 +0530 Subject: [PATCH] propogate domain if added at service level (#14270) --- .../service/search/SearchRepository.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java index 46863ad4f7c0..6951547e37d2 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java @@ -274,7 +274,19 @@ public void propagateInheritedFieldsToChildren( String entityType, String entityId, ChangeDescription changeDescription, IndexMapping indexMapping) { if (changeDescription != null) { Pair> updates = getInheritedFieldChanges(changeDescription); - Pair parentMatch = new ImmutablePair<>(entityType + ".id", entityId); + Pair parentMatch; + if (updates.getValue().get("type").toString().equalsIgnoreCase("domain") + && (entityType.equalsIgnoreCase(Entity.DATABASE_SERVICE) + || entityType.equalsIgnoreCase(Entity.DASHBOARD_SERVICE) + || entityType.equalsIgnoreCase(Entity.MESSAGING_SERVICE) + || entityType.equalsIgnoreCase(Entity.PIPELINE_SERVICE) + || entityType.equalsIgnoreCase(Entity.MLMODEL_SERVICE) + || entityType.equalsIgnoreCase(Entity.STORAGE_SERVICE) + || entityType.equalsIgnoreCase(Entity.SEARCH_SERVICE))) { + parentMatch = new ImmutablePair<>("service.id", entityId); + } else { + parentMatch = new ImmutablePair<>(entityType + ".id", entityId); + } if (updates.getKey() != null && !updates.getKey().isEmpty()) { searchClient.updateChildren(indexMapping.getAlias(), parentMatch, updates); }