diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java index e9428b9a7493..7585a7a7c164 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java @@ -1153,6 +1153,7 @@ public JsonObject aggregate(String query, String index, JsonObject aggregationJs } private static FunctionScoreQueryBuilder boostScore(QueryStringQueryBuilder queryBuilder) { + FunctionScoreQueryBuilder.FilterFunctionBuilder tier1Boost = new FunctionScoreQueryBuilder.FilterFunctionBuilder( QueryBuilders.termQuery("tier.tagFQN", "Tier.Tier1"), diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/ContainerIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/ContainerIndex.java index 2eabe35f5045..0f25bcfada76 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/ContainerIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/ContainerIndex.java @@ -57,7 +57,6 @@ public Map buildSearchIndexDocInternal(Map doc) Map commonAttributes = getCommonAttributesMap(container, Entity.CONTAINER); doc.putAll(commonAttributes); - doc.put("displayName", container.getDisplayName()); doc.put("tags", flattenedTagList); doc.put("tier", parseTags.getTierTag()); doc.put("service_suggest", serviceSuggest); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/DashboardIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/DashboardIndex.java index b47e8a0bebda..374e6bc546cb 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/DashboardIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/DashboardIndex.java @@ -48,8 +48,6 @@ public Map buildSearchIndexDocInternal(Map doc) } Map commonAttributes = getCommonAttributesMap(dashboard, Entity.DASHBOARD); doc.putAll(commonAttributes); - - doc.put("displayName", dashboard.getDisplayName()); doc.put("tags", parseTags.getTags()); doc.put("tier", parseTags.getTierTag()); doc.put("chart_suggest", chartSuggest); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/IngestionPipelineIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/IngestionPipelineIndex.java index 52878908632e..3a38121e8003 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/IngestionPipelineIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/IngestionPipelineIndex.java @@ -60,7 +60,6 @@ public Map buildSearchIndexDocInternal(Map doc) ingestionPipeline.getName() != null ? ingestionPipeline.getName() : ingestionPipeline.getDisplayName()); - doc.put("displayName", ingestionPipeline.getDisplayName()); doc.put("tags", parseTags.getTags()); doc.put("tier", parseTags.getTierTag()); doc.put("service_suggest", serviceSuggest); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/MlModelIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/MlModelIndex.java index f88f9c301524..98865b5f63ae 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/MlModelIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/MlModelIndex.java @@ -32,7 +32,6 @@ public Map buildSearchIndexDocInternal(Map doc) ParseTags parseTags = new ParseTags(Entity.getEntityTags(Entity.MLMODEL, mlModel)); Map commonAttributes = getCommonAttributesMap(mlModel, Entity.MLMODEL); doc.putAll(commonAttributes); - doc.put("displayName", mlModel.getDisplayName()); doc.put("tags", parseTags.getTags()); doc.put("tier", parseTags.getTierTag()); doc.put("serviceType", mlModel.getServiceType()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/PipelineIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/PipelineIndex.java index 37025da8f140..9479ae8d9470 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/PipelineIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/PipelineIndex.java @@ -46,7 +46,6 @@ public Map buildSearchIndexDocInternal(Map doc) Map commonAttributes = getCommonAttributesMap(pipeline, Entity.PIPELINE); doc.putAll(commonAttributes); doc.put("name", pipeline.getName() != null ? pipeline.getName() : pipeline.getDisplayName()); - doc.put("displayName", pipeline.getDisplayName()); doc.put("tags", parseTags.getTags()); doc.put("tier", parseTags.getTierTag()); doc.put("task_suggest", taskSuggest); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/QueryIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/QueryIndex.java index a19487eaefa8..89b5ce405f82 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/QueryIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/QueryIndex.java @@ -36,7 +36,6 @@ public Map buildSearchIndexDocInternal(Map doc) ParseTags parseTags = new ParseTags(Entity.getEntityTags(Entity.QUERY, query)); Map commonAttributes = getCommonAttributesMap(query, Entity.QUERY); doc.putAll(commonAttributes); - doc.put("displayName", query.getDisplayName()); doc.put("tags", parseTags.getTags()); doc.put("tier", parseTags.getTierTag()); return doc; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/SearchIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/SearchIndex.java index da016ce3c649..3f7dcd01435f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/SearchIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/SearchIndex.java @@ -3,13 +3,11 @@ import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty; import static org.openmetadata.service.Entity.FIELD_DESCRIPTION; import static org.openmetadata.service.Entity.FIELD_DISPLAY_NAME; -import static org.openmetadata.service.Entity.FIELD_NAME; import static org.openmetadata.service.jdbi3.LineageRepository.buildRelationshipDetailsMap; +import static org.openmetadata.service.search.EntityBuilderConstant.DISPLAY_NAME_KEYWORD; import static org.openmetadata.service.search.EntityBuilderConstant.FIELD_DISPLAY_NAME_NGRAM; -import static org.openmetadata.service.search.EntityBuilderConstant.FIELD_NAME_NGRAM; import static org.openmetadata.service.search.EntityBuilderConstant.FULLY_QUALIFIED_NAME; import static org.openmetadata.service.search.EntityBuilderConstant.FULLY_QUALIFIED_NAME_PARTS; -import static org.openmetadata.service.search.EntityBuilderConstant.NAME_KEYWORD; import java.util.ArrayList; import java.util.Collections; @@ -67,6 +65,9 @@ default List getSuggest() { default Map getCommonAttributesMap(EntityInterface entity, String entityType) { Map map = new HashMap<>(); List suggest = getSuggest(); + map.put( + "displayName", + entity.getDisplayName() != null ? entity.getDisplayName() : entity.getName()); map.put("entityType", entityType); map.put("owners", getEntitiesWithDisplayName(entity.getOwners())); map.put("domain", getEntityWithDisplayName(entity.getDomain())); @@ -163,11 +164,9 @@ static List> getLineageData(EntityReference entity) { static Map getDefaultFields() { Map fields = new HashMap<>(); - fields.put(FIELD_DISPLAY_NAME, 10.0f); + fields.put(DISPLAY_NAME_KEYWORD, 10.0f); fields.put(FIELD_DISPLAY_NAME_NGRAM, 1.0f); - fields.put(FIELD_NAME, 10.0f); - fields.put(NAME_KEYWORD, 10.0f); - fields.put(FIELD_NAME_NGRAM, 1.0f); + fields.put(FIELD_DISPLAY_NAME, 10.0f); fields.put(FIELD_DESCRIPTION, 2.0f); fields.put(FULLY_QUALIFIED_NAME, 5.0f); fields.put(FULLY_QUALIFIED_NAME_PARTS, 5.0f); @@ -177,6 +176,7 @@ static Map getDefaultFields() { static Map getAllFields() { Map fields = getDefaultFields(); fields.putAll(TableIndex.getFields()); + fields.putAll(StoredProcedureIndex.getFields()); fields.putAll(DashboardIndex.getFields()); fields.putAll(DashboardDataModelIndex.getFields()); fields.putAll(PipelineIndex.getFields()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TableIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TableIndex.java index fed4a015427f..3815f0b3f3b1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TableIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TableIndex.java @@ -91,7 +91,6 @@ public Map buildSearchIndexDocInternal(Map doc) .collect(ArrayList::new, ArrayList::add, ArrayList::addAll); Map commonAttributes = getCommonAttributesMap(table, Entity.TABLE); doc.putAll(commonAttributes); - doc.put("displayName", table.getDisplayName()); doc.put("tags", flattenedTagList); doc.put("tier", parseTags.getTierTag()); doc.put("service_suggest", serviceSuggest); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TeamIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TeamIndex.java index 79cc2829e5df..8eb4d435e944 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TeamIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TeamIndex.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.openmetadata.common.utils.CommonUtil; import org.openmetadata.schema.entity.teams.Team; import org.openmetadata.service.Entity; import org.openmetadata.service.search.models.SearchSuggest; @@ -39,9 +38,6 @@ public Map buildSearchIndexDocInternal(Map doc) Map commonAttributes = getCommonAttributesMap(team, Entity.TEAM); doc.putAll(commonAttributes); doc.put("isBot", false); - doc.put( - "displayName", - CommonUtil.nullOrEmpty(team.getDisplayName()) ? team.getName() : team.getDisplayName()); return doc; } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TopicIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TopicIndex.java index e734f1b99abc..109c97217eb4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TopicIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/TopicIndex.java @@ -76,7 +76,6 @@ public Map buildSearchIndexDocInternal(Map doc) .collect(ArrayList::new, ArrayList::add, ArrayList::addAll); Map commonAttributes = getCommonAttributesMap(topic, Entity.TOPIC); doc.putAll(commonAttributes); - doc.put("displayName", topic.getDisplayName()); doc.put("tags", flattenedTagList); doc.put("tier", parseTags.getTierTag()); doc.put("field_suggest", fieldSuggest); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/UserIndex.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/UserIndex.java index 57a7190a39a3..c52acd7b58ee 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/UserIndex.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/indexes/UserIndex.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.openmetadata.common.utils.CommonUtil; import org.openmetadata.schema.entity.teams.User; import org.openmetadata.service.Entity; import org.openmetadata.service.search.models.SearchSuggest; @@ -38,9 +37,6 @@ public Set getExcludedFields() { public Map buildSearchIndexDocInternal(Map doc) { Map commonAttributes = getCommonAttributesMap(user, Entity.USER); doc.putAll(commonAttributes); - doc.put( - "displayName", - CommonUtil.nullOrEmpty(user.getDisplayName()) ? user.getName() : user.getDisplayName()); if (user.getIsBot() == null) { doc.put("isBot", false); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java index 421676ce7dd6..80cf532e17e5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java @@ -8,7 +8,6 @@ import static org.openmetadata.service.Entity.DOMAIN; import static org.openmetadata.service.Entity.FIELD_DESCRIPTION; import static org.openmetadata.service.Entity.FIELD_DISPLAY_NAME; -import static org.openmetadata.service.Entity.FIELD_NAME; import static org.openmetadata.service.Entity.GLOSSARY_TERM; import static org.openmetadata.service.Entity.QUERY; import static org.openmetadata.service.Entity.RAW_COST_ANALYSIS_REPORT_DATA; @@ -22,7 +21,6 @@ import static org.openmetadata.service.search.EntityBuilderConstant.ES_TAG_FQN_FIELD; import static org.openmetadata.service.search.EntityBuilderConstant.FIELD_COLUMN_NAMES; import static org.openmetadata.service.search.EntityBuilderConstant.FIELD_DISPLAY_NAME_NGRAM; -import static org.openmetadata.service.search.EntityBuilderConstant.FIELD_NAME_NGRAM; import static org.openmetadata.service.search.EntityBuilderConstant.MAX_AGGREGATE_SIZE; import static org.openmetadata.service.search.EntityBuilderConstant.MAX_RESULT_HITS; import static org.openmetadata.service.search.EntityBuilderConstant.OWNER_DISPLAY_NAME_KEYWORD; @@ -981,12 +979,7 @@ private static FunctionScoreQueryBuilder boostScore(QueryStringQueryBuilder quer private static HighlightBuilder buildHighlights(List fields) { List defaultFields = - List.of( - FIELD_DISPLAY_NAME, - FIELD_NAME, - FIELD_DESCRIPTION, - FIELD_DISPLAY_NAME_NGRAM, - FIELD_NAME_NGRAM); + List.of(FIELD_DISPLAY_NAME, FIELD_DESCRIPTION, FIELD_DISPLAY_NAME_NGRAM); defaultFields = Stream.concat(defaultFields.stream(), fields.stream()).toList(); HighlightBuilder hb = new HighlightBuilder(); for (String field : defaultFields) { @@ -1306,6 +1299,7 @@ private static SearchSourceBuilder buildGenericDataAssetSearchBuilder( private static SearchSourceBuilder buildTableSearchBuilder(String query, int from, int size) { QueryStringQueryBuilder queryStringBuilder = buildSearchQueryBuilder(query, TableIndex.getFields()); + FunctionScoreQueryBuilder queryBuilder = boostScore(queryStringBuilder); HighlightBuilder hb = buildHighlights(List.of("columns.name", "columns.description", "columns.children.name"));