Skip to content

Commit c34abd8

Browse files
committed
Revert "MINOR: Fix delete entity relation live indexing (#19837)"
This reverts commit 0f9f00c.
1 parent 0f9f00c commit c34abd8

File tree

3 files changed

+0
-16
lines changed

3 files changed

+0
-16
lines changed

openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java

-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
import org.openmetadata.service.resources.databases.DatabaseUtil;
102102
import org.openmetadata.service.resources.databases.TableResource;
103103
import org.openmetadata.service.resources.feeds.MessageParser.EntityLink;
104-
import org.openmetadata.service.search.SearchClient;
105104
import org.openmetadata.service.security.mask.PIIMasker;
106105
import org.openmetadata.service.util.EntityUtil;
107106
import org.openmetadata.service.util.EntityUtil.Fields;
@@ -135,8 +134,6 @@ public class TableRepository extends EntityRepository<Table> {
135134
public static final String COLUMN_FIELD = "columns";
136135
public static final String CUSTOM_METRICS = "customMetrics";
137136

138-
private static final SearchClient searchClient = Entity.getSearchRepository().getSearchClient();
139-
140137
public TableRepository() {
141138
super(
142139
TableResource.COLLECTION_PATH,
@@ -1259,7 +1256,6 @@ private void deleteConstraintRelationship(Table table, List<TableConstraint> con
12591256
EntityReference toTable = Entity.getEntityReferenceByName(TABLE, toParent, ALL);
12601257
deleteRelationship(
12611258
table.getId(), TABLE, toTable.getId(), TABLE, Relationship.RELATED_TO);
1262-
searchRepository.deleteRelationshipFromSearch(table.getId(), toTable.getId());
12631259
} catch (EntityNotFoundException e) {
12641260
throw EntityNotFoundException.byName(
12651261
String.format(

openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java

-3
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ public interface SearchClient {
8585
String REMOVE_LINEAGE_SCRIPT =
8686
"for (int i = 0; i < ctx._source.lineage.length; i++) { if (ctx._source.lineage[i].doc_id == '%s') { ctx._source.lineage.remove(i) }}";
8787

88-
String REMOVE_ENTITY_RELATIONSHIP =
89-
"for (int i = 0; i < ctx._source.entityRelationship.length; i++) { if (ctx._source.entityRelationship[i].doc_id == '%s') { ctx._source.entityRelationship.remove(i) }}";
90-
9188
String ADD_UPDATE_LINEAGE =
9289
"boolean docIdExists = false; for (int i = 0; i < ctx._source.lineage.size(); i++) { if (ctx._source.lineage[i].doc_id.equalsIgnoreCase(params.lineageData.doc_id)) { ctx._source.lineage[i] = params.lineageData; docIdExists = true; break;}}if (!docIdExists) {ctx._source.lineage.add(params.lineageData);}";
9390

openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java

-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import static org.openmetadata.service.search.SearchClient.PROPAGATE_TEST_SUITES_SCRIPT;
2424
import static org.openmetadata.service.search.SearchClient.REMOVE_DATA_PRODUCTS_CHILDREN_SCRIPT;
2525
import static org.openmetadata.service.search.SearchClient.REMOVE_DOMAINS_CHILDREN_SCRIPT;
26-
import static org.openmetadata.service.search.SearchClient.REMOVE_ENTITY_RELATIONSHIP;
2726
import static org.openmetadata.service.search.SearchClient.REMOVE_OWNERS_SCRIPT;
2827
import static org.openmetadata.service.search.SearchClient.REMOVE_PROPAGATED_ENTITY_REFERENCE_FIELD_SCRIPT;
2928
import static org.openmetadata.service.search.SearchClient.REMOVE_PROPAGATED_FIELD_SCRIPT;
@@ -1162,12 +1161,4 @@ public List<EntityReference> getEntitiesContainingFQNFromES(
11621161
public Set<String> getSearchEntities() {
11631162
return new HashSet<>(entityIndexMap.keySet());
11641163
}
1165-
1166-
public void deleteRelationshipFromSearch(UUID fromTableId, UUID toTableId) {
1167-
String relationDocId = fromTableId.toString() + "-" + toTableId.toString();
1168-
searchClient.updateChildren(
1169-
GLOBAL_SEARCH_ALIAS,
1170-
new ImmutablePair<>("entityRelationship.doc_id.keyword", relationDocId),
1171-
new ImmutablePair<>(String.format(REMOVE_ENTITY_RELATIONSHIP, relationDocId), null));
1172-
}
11731164
}

0 commit comments

Comments
 (0)