From 9309cf94c147fb6499602b221609e6d760fc57fe Mon Sep 17 00:00:00 2001 From: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com> Date: Wed, 21 Aug 2024 16:26:50 +0530 Subject: [PATCH] Add Api Service, Collection and Endpoint in reindex app (#17527) * Add Api Service and Collection and Endpoint * Keep SearchIndexing as false by Default --- .../sql/migrations/native/1.5.0/mysql/schemaChanges.sql | 6 ++++++ .../sql/migrations/native/1.5.0/postgres/schemaChanges.sql | 6 ++++++ .../service/apps/bundles/searchIndex/SearchIndexApp.java | 5 ++++- .../resources/json/data/app/SearchIndexingApplication.json | 2 +- .../appMarketPlaceDefinition/SearchIndexingApplication.json | 2 +- .../utils/ApplicationSchemas/SearchIndexingApplication.json | 2 +- 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bootstrap/sql/migrations/native/1.5.0/mysql/schemaChanges.sql b/bootstrap/sql/migrations/native/1.5.0/mysql/schemaChanges.sql index 5040d629317..4aacc920ffd 100644 --- a/bootstrap/sql/migrations/native/1.5.0/mysql/schemaChanges.sql +++ b/bootstrap/sql/migrations/native/1.5.0/mysql/schemaChanges.sql @@ -303,3 +303,9 @@ ALTER TABLE automations_workflow ADD COLUMN workflowType VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.workflowType') STORED NOT NULL; ALTER TABLE entity_extension ADD INDEX extension_index(extension); + +-- Remove SearchIndexing for api Service, collection and endpoint +DELETE er FROM entity_relationship er JOIN installed_apps ia ON er.fromId = ia.id OR er.toId = ia.id WHERE ia.name = 'SearchIndexingApplication'; +DELETE er FROM entity_relationship er JOIN apps_marketplace ia ON er.fromId = ia.id OR er.toId = ia.id WHERE ia.name = 'SearchIndexingApplication'; +DELETE from installed_apps where name = 'SearchIndexingApplication'; +DELETE from apps_marketplace where name = 'SearchIndexingApplication'; \ No newline at end of file diff --git a/bootstrap/sql/migrations/native/1.5.0/postgres/schemaChanges.sql b/bootstrap/sql/migrations/native/1.5.0/postgres/schemaChanges.sql index fbae1bca5e9..3c61dd289d2 100644 --- a/bootstrap/sql/migrations/native/1.5.0/postgres/schemaChanges.sql +++ b/bootstrap/sql/migrations/native/1.5.0/postgres/schemaChanges.sql @@ -275,3 +275,9 @@ update table_entity set json = jsonb_set(json#-'{dataModel,owner}', '{dataModel, jsonb_build_array(json#>'{dataModel,owner}')) where json #>> '{dataModel,owner}' is not null; CREATE INDEX IF NOT EXISTS extension_index ON entity_extension (extension); + +-- Remove SearchIndexing for api Service, collection and endpoint +DELETE er FROM entity_relationship er JOIN installed_apps ia ON er.fromId = ia.id OR er.toId = ia.id WHERE ia.name = 'SearchIndexingApplication'; +DELETE er FROM entity_relationship er JOIN apps_marketplace ia ON er.fromId = ia.id OR er.toId = ia.id WHERE ia.name = 'SearchIndexingApplication'; +DELETE from installed_apps where name = 'SearchIndexingApplication'; +DELETE from apps_marketplace where name = 'SearchIndexingApplication'; \ No newline at end of file diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java index 06fc31325ef..477cd524944 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java @@ -89,7 +89,10 @@ public class SearchIndexApp extends AbstractNativeApplication { "domain", "storedProcedure", "storageService", - "testCaseResolutionStatus"); + "testCaseResolutionStatus", + "apiService", + "apiEndpoint", + "apiCollection"); public static final Set TIME_SERIES_ENTITIES = Set.of( ReportData.ReportDataType.ENTITY_REPORT_DATA.value(), diff --git a/openmetadata-service/src/main/resources/json/data/app/SearchIndexingApplication.json b/openmetadata-service/src/main/resources/json/data/app/SearchIndexingApplication.json index 189a3751009..1cd3e21d6d5 100644 --- a/openmetadata-service/src/main/resources/json/data/app/SearchIndexingApplication.json +++ b/openmetadata-service/src/main/resources/json/data/app/SearchIndexingApplication.json @@ -43,7 +43,7 @@ "apiEndpoint", "apiCollection" ], - "recreateIndex": true, + "recreateIndex": false, "batchSize": "100", "searchIndexMappingLanguage": "EN" }, diff --git a/openmetadata-service/src/main/resources/json/data/appMarketPlaceDefinition/SearchIndexingApplication.json b/openmetadata-service/src/main/resources/json/data/appMarketPlaceDefinition/SearchIndexingApplication.json index d12c0a8fc56..fbb2e167f72 100644 --- a/openmetadata-service/src/main/resources/json/data/appMarketPlaceDefinition/SearchIndexingApplication.json +++ b/openmetadata-service/src/main/resources/json/data/appMarketPlaceDefinition/SearchIndexingApplication.json @@ -57,7 +57,7 @@ "apiEndpoint", "apiCollection" ], - "recreateIndex": true, + "recreateIndex": false, "batchSize": "100", "searchIndexMappingLanguage": "EN" } diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/ApplicationSchemas/SearchIndexingApplication.json b/openmetadata-ui/src/main/resources/ui/src/utils/ApplicationSchemas/SearchIndexingApplication.json index eb98bd39bff..fbaad6dfa3d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/ApplicationSchemas/SearchIndexingApplication.json +++ b/openmetadata-ui/src/main/resources/ui/src/utils/ApplicationSchemas/SearchIndexingApplication.json @@ -65,7 +65,7 @@ "recreateIndex": { "title": "Recreate Indexes", "type": "boolean", - "default": true + "default": false }, "searchIndexMappingLanguage": { "description": "Recreate Indexes with updated Language",