From cdb94e476b20c2eb1863e90c9bc87b82fcc53eb8 Mon Sep 17 00:00:00 2001 From: 07Himank <112613760+07Himank@users.noreply.github.com> Date: Mon, 16 Oct 2023 19:22:44 +0530 Subject: [PATCH] Fix glossary highlighter (#13586) * fix glossary highlighter issue * indentation --- .../elasticsearch/ElasticSearchClient.java | 5 +- .../search/opensearch/OpenSearchClient.java | 5 +- .../en/glossary_term_index_mapping.json | 682 +++++++++--------- 3 files changed, 349 insertions(+), 343 deletions(-) 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 14cfc06a5ae..9bca6d8d450 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 @@ -356,7 +356,10 @@ public class ElasticSearchClient implements SearchClient { } if (request.getIndex().equalsIgnoreCase("glossary_term_search_index")) { - searchSourceBuilder.query(QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("status", "Approved"))); + searchSourceBuilder.query( + QueryBuilders.boolQuery() + .must(searchSourceBuilder.query()) + .must(QueryBuilders.matchQuery("status", "Approved"))); } /* for performance reasons ElasticSearch doesn't provide accurate hits 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 b449a0bcd86..71e4ae5dbac 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 @@ -348,7 +348,10 @@ public class OpenSearchClient implements SearchClient { } if (request.getIndex().equalsIgnoreCase("glossary_term_search_index")) { - searchSourceBuilder.query(QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("status", "Approved"))); + searchSourceBuilder.query( + QueryBuilders.boolQuery() + .must(searchSourceBuilder.query()) + .must(QueryBuilders.matchQuery("status", "Approved"))); } /* for performance reasons OpenSearch doesn't provide accurate hits diff --git a/openmetadata-service/src/main/resources/elasticsearch/en/glossary_term_index_mapping.json b/openmetadata-service/src/main/resources/elasticsearch/en/glossary_term_index_mapping.json index ca595198038..5dbb11b8544 100644 --- a/openmetadata-service/src/main/resources/elasticsearch/en/glossary_term_index_mapping.json +++ b/openmetadata-service/src/main/resources/elasticsearch/en/glossary_term_index_mapping.json @@ -68,351 +68,351 @@ } } }, - "fqnParts": { - "type": "keyword" - }, - "domain": { - "properties": { - "id": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 36 - } + "fqnParts": { + "type": "keyword" + }, + "domain": { + "properties": { + "id": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 36 } - }, - "type": { - "type": "keyword" - }, - "name": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fullyQualifiedName": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "deleted": { - "type": "text" - }, - "href": { - "type": "text" } + }, + "type": { + "type": "keyword" + }, + "name": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "fullyQualifiedName": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "deleted": { + "type": "text" + }, + "href": { + "type": "text" } - }, - "displayName": { - "type": "text", - "analyzer": "om_analyzer", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - }, - "ngram": { - "type": "text", - "analyzer": "om_ngram" - } - } - }, - "description": { - "type": "text", - "analyzer": "om_analyzer", - "index_options": "freqs" - }, - "owner": { - "properties": { - "id": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 36 - } - } - }, - "type": { - "type": "keyword" - }, - "name": { - "type": "keyword", - "normalizer": "lowercase_normalizer", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "displayName": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fullyQualifiedName": { - "type": "text" - }, - "description": { - "type": "text" - }, - "deleted": { - "type": "text" - }, - "href": { - "type": "text" - } - } - }, - "version": { - "type": "float" - }, - "updatedAt": { - "type": "date", - "format": "epoch_second" - }, - "updatedBy": { - "type": "text" - }, - "href": { - "type": "text" - }, - "synonyms": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - }, - "ngram": { - "type": "text", - "analyzer": "om_ngram" - } - } - }, - "glossary": { - "properties": { - "id": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 36 - } - } - }, - "type": { - "type": "keyword" - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - }, - "ngram": { - "type": "text", - "analyzer": "om_ngram" - } - } - }, - "displayName": { - "type": "text", - "analyzer": "om_analyzer", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - }, - "ngram": { - "type": "text", - "analyzer": "om_ngram" - } - } - }, - "fullyQualifiedName": { - "type": "text" - }, - "description": { - "type": "text" - }, - "deleted": { - "type": "text" - }, - "href": { - "type": "text" - } - } - }, - "children": { - "properties": { - "id": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 36 - } - } - }, - "type": { - "type": "keyword" - }, - "name": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fullyQualifiedName": { - "type": "text" - }, - "description": { - "type": "text" - }, - "deleted": { - "type": "text" - }, - "href": { - "type": "text" - } - } - }, - "relatedTerms": { - "properties": { - "id": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 36 - } - } - }, - "type": { - "type": "keyword" - }, - "name": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fullyQualifiedName": { - "type": "text" - }, - "description": { - "type": "text" - }, - "deleted": { - "type": "text" - }, - "href": { - "type": "text" - } - } - }, - "reviewers": { - "properties": { - "id": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 36 - } - } - }, - "type": { - "type": "keyword" - }, - "name": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "displayName": { - "type": "keyword", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fullyQualifiedName": { - "type": "text" - }, - "description": { - "type": "text" - }, - "deleted": { - "type": "text" - }, - "href": { - "type": "text" - } - } - }, - "usageCount": { - "type": "integer" - }, - "tags": { - "properties": { - "tagFQN": { - "type": "keyword" - }, - "labelType": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "source": { - "type": "keyword" - }, - "state": { - "type": "keyword" - } - } - }, - "deleted": { - "type": "text" - }, - "status": { - "type": "text" - }, - "suggest": { - "type": "completion", - "contexts": [ - { - "name": "deleted", - "type": "category", - "path": "deleted" - } - ] } + }, + "displayName": { + "type": "text", + "analyzer": "om_analyzer", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + }, + "ngram": { + "type": "text", + "analyzer": "om_ngram" + } + } + }, + "description": { + "type": "text", + "analyzer": "om_analyzer", + "index_options": "freqs" + }, + "owner": { + "properties": { + "id": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 36 + } + } + }, + "type": { + "type": "keyword" + }, + "name": { + "type": "keyword", + "normalizer": "lowercase_normalizer", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "displayName": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "fullyQualifiedName": { + "type": "text" + }, + "description": { + "type": "text" + }, + "deleted": { + "type": "text" + }, + "href": { + "type": "text" + } + } + }, + "version": { + "type": "float" + }, + "updatedAt": { + "type": "date", + "format": "epoch_second" + }, + "updatedBy": { + "type": "text" + }, + "href": { + "type": "text" + }, + "synonyms": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + }, + "ngram": { + "type": "text", + "analyzer": "om_ngram" + } + } + }, + "glossary": { + "properties": { + "id": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 36 + } + } + }, + "type": { + "type": "keyword" + }, + "name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + }, + "ngram": { + "type": "text", + "analyzer": "om_ngram" + } + } + }, + "displayName": { + "type": "text", + "analyzer": "om_analyzer", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + }, + "ngram": { + "type": "text", + "analyzer": "om_ngram" + } + } + }, + "fullyQualifiedName": { + "type": "text" + }, + "description": { + "type": "text" + }, + "deleted": { + "type": "text" + }, + "href": { + "type": "text" + } + } + }, + "children": { + "properties": { + "id": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 36 + } + } + }, + "type": { + "type": "keyword" + }, + "name": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "fullyQualifiedName": { + "type": "text" + }, + "description": { + "type": "text" + }, + "deleted": { + "type": "text" + }, + "href": { + "type": "text" + } + } + }, + "relatedTerms": { + "properties": { + "id": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 36 + } + } + }, + "type": { + "type": "keyword" + }, + "name": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "fullyQualifiedName": { + "type": "text" + }, + "description": { + "type": "text" + }, + "deleted": { + "type": "text" + }, + "href": { + "type": "text" + } + } + }, + "reviewers": { + "properties": { + "id": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 36 + } + } + }, + "type": { + "type": "keyword" + }, + "name": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "displayName": { + "type": "keyword", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "fullyQualifiedName": { + "type": "text" + }, + "description": { + "type": "text" + }, + "deleted": { + "type": "text" + }, + "href": { + "type": "text" + } + } + }, + "usageCount": { + "type": "integer" + }, + "tags": { + "properties": { + "tagFQN": { + "type": "keyword" + }, + "labelType": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "source": { + "type": "keyword" + }, + "state": { + "type": "keyword" + } + } + }, + "deleted": { + "type": "text" + }, + "status": { + "type": "text" + }, + "suggest": { + "type": "completion", + "contexts": [ + { + "name": "deleted", + "type": "category", + "path": "deleted" + } + ] + } } } }