mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-11-03 20:19:31 +00:00 
			
		
		
		
	Search Index read entities from index mapping (#19084)
(cherry picked from commit 2888e379984d1342f00b86c81ff15dca2cb0c297)
This commit is contained in:
		
							parent
							
								
									a0e755731d
								
							
						
					
					
						commit
						88bbddb6da
					
				@ -1,47 +1,8 @@
 | 
			
		||||
package org.openmetadata.service.apps.bundles.searchIndex;
 | 
			
		||||
 | 
			
		||||
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
 | 
			
		||||
import static org.openmetadata.service.Entity.API_COLLCECTION;
 | 
			
		||||
import static org.openmetadata.service.Entity.API_ENDPOINT;
 | 
			
		||||
import static org.openmetadata.service.Entity.API_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.CHART;
 | 
			
		||||
import static org.openmetadata.service.Entity.CLASSIFICATION;
 | 
			
		||||
import static org.openmetadata.service.Entity.CONTAINER;
 | 
			
		||||
import static org.openmetadata.service.Entity.DASHBOARD;
 | 
			
		||||
import static org.openmetadata.service.Entity.DASHBOARD_DATA_MODEL;
 | 
			
		||||
import static org.openmetadata.service.Entity.DASHBOARD_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.DATABASE;
 | 
			
		||||
import static org.openmetadata.service.Entity.DATABASE_SCHEMA;
 | 
			
		||||
import static org.openmetadata.service.Entity.DATABASE_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.DATA_PRODUCT;
 | 
			
		||||
import static org.openmetadata.service.Entity.DOMAIN;
 | 
			
		||||
import static org.openmetadata.service.Entity.ENTITY_REPORT_DATA;
 | 
			
		||||
import static org.openmetadata.service.Entity.GLOSSARY;
 | 
			
		||||
import static org.openmetadata.service.Entity.GLOSSARY_TERM;
 | 
			
		||||
import static org.openmetadata.service.Entity.INGESTION_PIPELINE;
 | 
			
		||||
import static org.openmetadata.service.Entity.MESSAGING_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.METADATA_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.METRIC;
 | 
			
		||||
import static org.openmetadata.service.Entity.MLMODEL;
 | 
			
		||||
import static org.openmetadata.service.Entity.MLMODEL_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.PIPELINE;
 | 
			
		||||
import static org.openmetadata.service.Entity.PIPELINE_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.QUERY;
 | 
			
		||||
import static org.openmetadata.service.Entity.SEARCH_INDEX;
 | 
			
		||||
import static org.openmetadata.service.Entity.SEARCH_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.STORAGE_SERVICE;
 | 
			
		||||
import static org.openmetadata.service.Entity.STORED_PROCEDURE;
 | 
			
		||||
import static org.openmetadata.service.Entity.TABLE;
 | 
			
		||||
import static org.openmetadata.service.Entity.TAG;
 | 
			
		||||
import static org.openmetadata.service.Entity.TEAM;
 | 
			
		||||
import static org.openmetadata.service.Entity.TEST_CASE;
 | 
			
		||||
import static org.openmetadata.service.Entity.TEST_CASE_RESOLUTION_STATUS;
 | 
			
		||||
import static org.openmetadata.service.Entity.TEST_CASE_RESULT;
 | 
			
		||||
import static org.openmetadata.service.Entity.TEST_SUITE;
 | 
			
		||||
import static org.openmetadata.service.Entity.TOPIC;
 | 
			
		||||
import static org.openmetadata.service.Entity.USER;
 | 
			
		||||
import static org.openmetadata.service.Entity.WEB_ANALYTIC_ENTITY_VIEW_REPORT_DATA;
 | 
			
		||||
import static org.openmetadata.service.Entity.WEB_ANALYTIC_USER_ACTIVITY_REPORT_DATA;
 | 
			
		||||
import static org.openmetadata.service.apps.scheduler.AbstractOmAppJobListener.APP_RUN_STATS;
 | 
			
		||||
import static org.openmetadata.service.apps.scheduler.AbstractOmAppJobListener.WEBSOCKET_STATUS_CHANNEL;
 | 
			
		||||
import static org.openmetadata.service.apps.scheduler.AppScheduler.ON_DEMAND_JOB;
 | 
			
		||||
@ -99,53 +60,8 @@ import org.quartz.JobExecutionContext;
 | 
			
		||||
 | 
			
		||||
@Slf4j
 | 
			
		||||
public class SearchIndexApp extends AbstractNativeApplication {
 | 
			
		||||
 | 
			
		||||
  private static final String ALL = "all";
 | 
			
		||||
 | 
			
		||||
  public static final Set<String> ALL_ENTITIES =
 | 
			
		||||
      Set.of(
 | 
			
		||||
          TABLE,
 | 
			
		||||
          DASHBOARD,
 | 
			
		||||
          TOPIC,
 | 
			
		||||
          PIPELINE,
 | 
			
		||||
          INGESTION_PIPELINE,
 | 
			
		||||
          SEARCH_INDEX,
 | 
			
		||||
          USER,
 | 
			
		||||
          TEAM,
 | 
			
		||||
          GLOSSARY,
 | 
			
		||||
          GLOSSARY_TERM,
 | 
			
		||||
          MLMODEL,
 | 
			
		||||
          TAG,
 | 
			
		||||
          CLASSIFICATION,
 | 
			
		||||
          QUERY,
 | 
			
		||||
          CONTAINER,
 | 
			
		||||
          DATABASE,
 | 
			
		||||
          DATABASE_SCHEMA,
 | 
			
		||||
          TEST_CASE,
 | 
			
		||||
          TEST_SUITE,
 | 
			
		||||
          CHART,
 | 
			
		||||
          DASHBOARD_DATA_MODEL,
 | 
			
		||||
          DATABASE_SERVICE,
 | 
			
		||||
          MESSAGING_SERVICE,
 | 
			
		||||
          DASHBOARD_SERVICE,
 | 
			
		||||
          PIPELINE_SERVICE,
 | 
			
		||||
          MLMODEL_SERVICE,
 | 
			
		||||
          STORAGE_SERVICE,
 | 
			
		||||
          METADATA_SERVICE,
 | 
			
		||||
          SEARCH_SERVICE,
 | 
			
		||||
          ENTITY_REPORT_DATA,
 | 
			
		||||
          WEB_ANALYTIC_ENTITY_VIEW_REPORT_DATA,
 | 
			
		||||
          WEB_ANALYTIC_USER_ACTIVITY_REPORT_DATA,
 | 
			
		||||
          DOMAIN,
 | 
			
		||||
          STORED_PROCEDURE,
 | 
			
		||||
          DATA_PRODUCT,
 | 
			
		||||
          TEST_CASE_RESOLUTION_STATUS,
 | 
			
		||||
          TEST_CASE_RESULT,
 | 
			
		||||
          API_SERVICE,
 | 
			
		||||
          API_ENDPOINT,
 | 
			
		||||
          API_COLLCECTION,
 | 
			
		||||
          METRIC);
 | 
			
		||||
 | 
			
		||||
  public static final Set<String> TIME_SERIES_ENTITIES =
 | 
			
		||||
      Set.of(
 | 
			
		||||
          ReportData.ReportDataType.ENTITY_REPORT_DATA.value(),
 | 
			
		||||
@ -180,8 +96,9 @@ public class SearchIndexApp extends AbstractNativeApplication {
 | 
			
		||||
        JsonUtils.convertValue(app.getAppConfiguration(), EventPublisherJob.class)
 | 
			
		||||
            .withStats(new Stats());
 | 
			
		||||
 | 
			
		||||
    if (request.getEntities().contains(ALL)) {
 | 
			
		||||
      request.setEntities(ALL_ENTITIES);
 | 
			
		||||
    if (request.getEntities().size() == 1 && request.getEntities().contains(ALL)) {
 | 
			
		||||
      SearchRepository searchRepo = Entity.getSearchRepo();
 | 
			
		||||
      request.setEntities(searchRepo.getSearchEntities());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    jobData = request;
 | 
			
		||||
 | 
			
		||||
@ -38,6 +38,7 @@ import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.LinkedHashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@ -1057,4 +1058,8 @@ public class SearchRepository {
 | 
			
		||||
    }
 | 
			
		||||
    return new ArrayList<>();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public Set<String> getSearchEntities() {
 | 
			
		||||
    return new HashSet<>(entityIndexMap.keySet());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -66,46 +66,48 @@
 | 
			
		||||
        "type": "string",
 | 
			
		||||
        "enum": [
 | 
			
		||||
          "table",
 | 
			
		||||
          "dashboard",
 | 
			
		||||
          "topic",
 | 
			
		||||
          "pipeline",
 | 
			
		||||
          "ingestionPipeline",
 | 
			
		||||
          "searchIndex",
 | 
			
		||||
          "user",
 | 
			
		||||
          "team",
 | 
			
		||||
          "glossary",
 | 
			
		||||
          "glossaryTerm",
 | 
			
		||||
          "mlmodel",
 | 
			
		||||
          "tag",
 | 
			
		||||
          "classification",
 | 
			
		||||
          "query",
 | 
			
		||||
          "container",
 | 
			
		||||
          "database",
 | 
			
		||||
          "databaseSchema",
 | 
			
		||||
          "testCase",
 | 
			
		||||
          "container",
 | 
			
		||||
          "testSuite",
 | 
			
		||||
          "chart",
 | 
			
		||||
          "dashboardDataModel",
 | 
			
		||||
          "databaseService",
 | 
			
		||||
          "messagingService",
 | 
			
		||||
          "dashboardService",
 | 
			
		||||
          "pipelineService",
 | 
			
		||||
          "mlmodelService",
 | 
			
		||||
          "storageService",
 | 
			
		||||
          "pipelineService",
 | 
			
		||||
          "messagingService",
 | 
			
		||||
          "entityReportData",
 | 
			
		||||
          "ingestionPipeline",
 | 
			
		||||
          "database",
 | 
			
		||||
          "metadataService",
 | 
			
		||||
          "searchService",
 | 
			
		||||
          "entityReportData",
 | 
			
		||||
          "aggregatedCostAnalysisReportData",
 | 
			
		||||
          "tag",
 | 
			
		||||
          "dashboard",
 | 
			
		||||
          "rawCostAnalysisReportData",
 | 
			
		||||
          "webAnalyticEntityViewReportData",
 | 
			
		||||
          "webAnalyticUserActivityReportData",
 | 
			
		||||
          "domain",
 | 
			
		||||
          "storedProcedure",
 | 
			
		||||
          "dataProduct",
 | 
			
		||||
          "testCaseResolutionStatus",
 | 
			
		||||
          "testCaseResult",
 | 
			
		||||
          "databaseService",
 | 
			
		||||
          "dashboardService",
 | 
			
		||||
          "query",
 | 
			
		||||
          "apiService",
 | 
			
		||||
          "apiEndpoint",
 | 
			
		||||
          "searchIndex",
 | 
			
		||||
          "testCaseResult",
 | 
			
		||||
          "apiCollection",
 | 
			
		||||
          "metric"
 | 
			
		||||
          "team",
 | 
			
		||||
          "mlmodel",
 | 
			
		||||
          "classification",
 | 
			
		||||
          "glossaryTerm",
 | 
			
		||||
          "testCaseResolutionStatus",
 | 
			
		||||
          "dashboardDataModel",
 | 
			
		||||
          "pipeline",
 | 
			
		||||
          "glossary",
 | 
			
		||||
          "apiEndpoint",
 | 
			
		||||
          "storageService",
 | 
			
		||||
          "metric",
 | 
			
		||||
          "webAnalyticUserActivityReportData",
 | 
			
		||||
          "domain",
 | 
			
		||||
          "topic",
 | 
			
		||||
          "chart",
 | 
			
		||||
          "user",
 | 
			
		||||
          "testCase"
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "default": ["all"],
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user