mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 01:15:08 +00:00
This reverts commit a7ef0a82b1df4ec103fcbf8f2573ed907483060f.
This commit is contained in:
parent
1ecf5607c7
commit
a8c6f8bce0
@ -76,9 +76,6 @@ public class ElasticSearchIndexDefinition {
|
||||
ENTITY_REPORT_DATA, "entity_report_data_index", "/elasticsearch/entity_report_data_index.json"),
|
||||
TEST_CASE_SEARCH_INDEX(
|
||||
Entity.TEST_CASE, "test_case_search_index", "/elasticsearch/%s/test_case_index_mapping.json"),
|
||||
|
||||
TEST_SUITE_SEARCH_INDEX(
|
||||
Entity.TEST_SUITE, "test_suite_search_index", "/elasticsearch/%s/test_suite_index_mapping.json"),
|
||||
WEB_ANALYTIC_ENTITY_VIEW_REPORT_DATA_INDEX(
|
||||
Entity.WEB_ANALYTIC_EVENT,
|
||||
"web_analytic_entity_view_report_data_index",
|
||||
@ -174,10 +171,8 @@ public class ElasticSearchIndexDefinition {
|
||||
return ElasticSearchIndexType.CONTAINER_SEARCH_INDEX;
|
||||
} else if (type.equalsIgnoreCase(Entity.QUERY)) {
|
||||
return ElasticSearchIndexType.QUERY_SEARCH_INDEX;
|
||||
} else if (type.equalsIgnoreCase(Entity.TEST_CASE)) {
|
||||
} else if (type.equalsIgnoreCase(Entity.TEST_SUITE) || type.equalsIgnoreCase(Entity.TEST_CASE)) {
|
||||
return ElasticSearchIndexType.TEST_CASE_SEARCH_INDEX;
|
||||
} else if (type.equalsIgnoreCase(Entity.TEST_SUITE)) {
|
||||
return ElasticSearchIndexType.TEST_SUITE_SEARCH_INDEX;
|
||||
}
|
||||
throw new EventPublisherException("Failed to find index doc for type " + type);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import org.openmetadata.schema.entity.data.Topic;
|
||||
import org.openmetadata.schema.entity.teams.Team;
|
||||
import org.openmetadata.schema.entity.teams.User;
|
||||
import org.openmetadata.schema.tests.TestCase;
|
||||
import org.openmetadata.schema.tests.TestSuite;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.elasticsearch.indexes.ContainerIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.DashboardIndex;
|
||||
@ -25,7 +24,6 @@ import org.openmetadata.service.elasticsearch.indexes.QueryIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TableIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TagIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TeamIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TestSuiteIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TopicIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.UserIndex;
|
||||
|
||||
@ -58,9 +56,8 @@ public class ElasticSearchIndexFactory {
|
||||
case Entity.CONTAINER:
|
||||
return new ContainerIndex((Container) entity);
|
||||
case Entity.TEST_CASE:
|
||||
return new TestCaseIndex((TestCase) entity);
|
||||
case Entity.TEST_SUITE:
|
||||
return new TestSuiteIndex((TestSuite) entity);
|
||||
return new TestCaseIndex((TestCase) entity);
|
||||
default:
|
||||
LOG.warn("Ignoring Entity Type {}", entityType);
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
package org.openmetadata.service.elasticsearch.indexes;
|
||||
|
||||
import java.util.Map;
|
||||
import org.openmetadata.schema.tests.TestSuite;
|
||||
import org.openmetadata.service.util.JsonUtils;
|
||||
|
||||
public class TestSuiteIndex implements ElasticSearchIndex {
|
||||
TestSuite testSuite;
|
||||
|
||||
public TestSuiteIndex(TestSuite testSuite) {
|
||||
this.testSuite = testSuite;
|
||||
}
|
||||
|
||||
public Map<String, Object> buildESDoc() {
|
||||
Map<String, Object> doc = JsonUtils.getMap(testSuite);
|
||||
return doc;
|
||||
}
|
||||
}
|
@ -133,7 +133,6 @@ import org.openmetadata.service.elasticsearch.indexes.ElasticSearchIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.GlossaryTermIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TagIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TeamIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TestSuiteIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.UserIndex;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.DataInsightChartRepository;
|
||||
@ -280,7 +279,6 @@ public class ElasticSearchClientImpl implements SearchClient {
|
||||
searchSourceBuilder = buildQuerySearchBuilder(request.getQuery(), request.getFrom(), request.getSize());
|
||||
break;
|
||||
case "test_case_search_index":
|
||||
case "test_suite_search_index":
|
||||
searchSourceBuilder = buildTestCaseSearch(request.getQuery(), request.getFrom(), request.getSize());
|
||||
break;
|
||||
default:
|
||||
@ -1180,33 +1178,26 @@ public class ElasticSearchClientImpl implements SearchClient {
|
||||
@Override
|
||||
public void updateTestSuite(ChangeEvent event) throws IOException {
|
||||
ElasticSearchIndexDefinition.ElasticSearchIndexType indexType =
|
||||
ElasticSearchIndexDefinition.getIndexMappingByEntityType(Entity.TEST_SUITE);
|
||||
ElasticSearchIndexDefinition.getIndexMappingByEntityType(Entity.TEST_CASE);
|
||||
TestSuite testSuite = (TestSuite) event.getEntity();
|
||||
UUID testSuiteId = testSuite.getId();
|
||||
|
||||
UpdateRequest updateRequest = new UpdateRequest(indexType.indexName, testSuiteId.toString());
|
||||
TestSuiteIndex testSuiteIndex;
|
||||
|
||||
switch (event.getEventType()) {
|
||||
case ENTITY_CREATED:
|
||||
testSuiteIndex = new TestSuiteIndex((TestSuite) event.getEntity());
|
||||
updateRequest.doc(JsonUtils.pojoToJson(testSuiteIndex.buildESDoc()), XContentType.JSON);
|
||||
updateRequest.docAsUpsert(true);
|
||||
updateElasticSearch(updateRequest);
|
||||
break;
|
||||
case ENTITY_UPDATED:
|
||||
testSuiteIndex = new TestSuiteIndex((TestSuite) event.getEntity());
|
||||
scriptedUpsert(testSuiteIndex.buildESDoc(), updateRequest);
|
||||
updateElasticSearch(updateRequest);
|
||||
break;
|
||||
case ENTITY_SOFT_DELETED:
|
||||
softDeleteEntity(updateRequest);
|
||||
updateElasticSearch(updateRequest);
|
||||
break;
|
||||
case ENTITY_DELETED:
|
||||
DeleteRequest deleteRequest = new DeleteRequest(indexType.indexName, event.getEntityId().toString());
|
||||
deleteEntityFromElasticSearch(deleteRequest);
|
||||
break;
|
||||
if (event.getEventType() == ENTITY_DELETED) {
|
||||
if (testSuite.getExecutable()) {
|
||||
DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(indexType.indexName);
|
||||
deleteByQueryRequest.setQuery(new MatchQueryBuilder("testSuites.id", testSuiteId.toString()));
|
||||
deleteEntityFromElasticSearchByQuery(deleteByQueryRequest);
|
||||
} else {
|
||||
UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(indexType.indexName);
|
||||
updateByQueryRequest.setQuery(new MatchQueryBuilder("testSuites.id", testSuiteId.toString()));
|
||||
String scriptTxt =
|
||||
"for (int i = 0; i < ctx._source.testSuites.length; i++) { if (ctx._source.testSuites[i].id == '%s') { ctx._source.testSuites.remove(i) }}";
|
||||
Script script =
|
||||
new Script(
|
||||
ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, String.format(scriptTxt, testSuiteId), new HashMap<>());
|
||||
updateByQueryRequest.setScript(script);
|
||||
updateElasticSearchByQuery(updateByQueryRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@ import org.openmetadata.service.elasticsearch.indexes.ElasticSearchIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.GlossaryTermIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TagIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TeamIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.TestSuiteIndex;
|
||||
import org.openmetadata.service.elasticsearch.indexes.UserIndex;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.DataInsightChartRepository;
|
||||
@ -280,7 +279,6 @@ public class OpenSearchClientImpl implements SearchClient {
|
||||
searchSourceBuilder = buildQuerySearchBuilder(request.getQuery(), request.getFrom(), request.getSize());
|
||||
break;
|
||||
case "test_case_search_index":
|
||||
case "test_suite_search_index":
|
||||
searchSourceBuilder = buildTestCaseSearch(request.getQuery(), request.getFrom(), request.getSize());
|
||||
break;
|
||||
default:
|
||||
@ -1174,33 +1172,26 @@ public class OpenSearchClientImpl implements SearchClient {
|
||||
@Override
|
||||
public void updateTestSuite(ChangeEvent event) throws IOException {
|
||||
ElasticSearchIndexDefinition.ElasticSearchIndexType indexType =
|
||||
ElasticSearchIndexDefinition.getIndexMappingByEntityType(Entity.TEST_SUITE);
|
||||
ElasticSearchIndexDefinition.getIndexMappingByEntityType(Entity.TEST_CASE);
|
||||
TestSuite testSuite = (TestSuite) event.getEntity();
|
||||
UUID testSuiteId = testSuite.getId();
|
||||
|
||||
UpdateRequest updateRequest = new UpdateRequest(indexType.indexName, testSuiteId.toString());
|
||||
TestSuiteIndex testSuiteIndex;
|
||||
|
||||
switch (event.getEventType()) {
|
||||
case ENTITY_CREATED:
|
||||
testSuiteIndex = new TestSuiteIndex((TestSuite) event.getEntity());
|
||||
updateRequest.doc(JsonUtils.pojoToJson(testSuiteIndex.buildESDoc()), XContentType.JSON);
|
||||
updateRequest.docAsUpsert(true);
|
||||
updateElasticSearch(updateRequest);
|
||||
break;
|
||||
case ENTITY_UPDATED:
|
||||
testSuiteIndex = new TestSuiteIndex((TestSuite) event.getEntity());
|
||||
scriptedUpsert(testSuiteIndex.buildESDoc(), updateRequest);
|
||||
updateElasticSearch(updateRequest);
|
||||
break;
|
||||
case ENTITY_SOFT_DELETED:
|
||||
softDeleteEntity(updateRequest);
|
||||
updateElasticSearch(updateRequest);
|
||||
break;
|
||||
case ENTITY_DELETED:
|
||||
DeleteRequest deleteRequest = new DeleteRequest(indexType.indexName, event.getEntityId().toString());
|
||||
deleteEntityFromElasticSearch(deleteRequest);
|
||||
break;
|
||||
if (event.getEventType() == ENTITY_DELETED) {
|
||||
if (Boolean.TRUE.equals(testSuite.getExecutable())) {
|
||||
DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(indexType.indexName);
|
||||
deleteByQueryRequest.setQuery(new MatchQueryBuilder("testSuites.id", testSuiteId.toString()));
|
||||
deleteEntityFromElasticSearchByQuery(deleteByQueryRequest);
|
||||
} else {
|
||||
UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(indexType.indexName);
|
||||
updateByQueryRequest.setQuery(new MatchQueryBuilder("testSuites.id", testSuiteId.toString()));
|
||||
String scriptTxt =
|
||||
"for (int i = 0; i < ctx._source.testSuites.length; i++) { if (ctx._source.testSuites[i].id == '%s') { ctx._source.testSuites.remove(i) }}";
|
||||
Script script =
|
||||
new Script(
|
||||
ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, String.format(scriptTxt, testSuiteId), new HashMap<>());
|
||||
updateByQueryRequest.setScript(script);
|
||||
updateElasticSearchByQuery(updateByQueryRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,92 +0,0 @@
|
||||
{
|
||||
"settings": {
|
||||
"analysis": {
|
||||
"normalizer": {
|
||||
"lowercase_normalizer": {
|
||||
"type": "custom",
|
||||
"char_filter": [],
|
||||
"filter": [
|
||||
"lowercase"
|
||||
]
|
||||
}
|
||||
},
|
||||
"analyzer": {
|
||||
"om_analyzer": {
|
||||
"tokenizer": "letter",
|
||||
"filter": [
|
||||
"lowercase",
|
||||
"om_stemmer"
|
||||
]
|
||||
},
|
||||
"om_ngram": {
|
||||
"tokenizer": "ngram",
|
||||
"min_gram": 2,
|
||||
"max_gram": 3,
|
||||
"filter": [
|
||||
"lowercase"
|
||||
]
|
||||
}
|
||||
},
|
||||
"filter": {
|
||||
"om_stemmer": {
|
||||
"type": "stemmer",
|
||||
"name": "english"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"name": {
|
||||
"type": "text",
|
||||
"analyzer": "om_analyzer",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
},
|
||||
"ngram": {
|
||||
"type": "text",
|
||||
"analyzer": "om_ngram"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fullyQualifiedName": {
|
||||
"type": "keyword",
|
||||
"normalizer": "lowercase_normalizer"
|
||||
},
|
||||
"description": {
|
||||
"type": "text",
|
||||
"analyzer": "om_analyzer",
|
||||
"fields": {
|
||||
"ngram": {
|
||||
"type": "text",
|
||||
"analyzer": "om_ngram"
|
||||
}
|
||||
}
|
||||
},
|
||||
"displayName": {
|
||||
"type": "text",
|
||||
"analyzer": "om_analyzer",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"deleted": {
|
||||
"type": "text"
|
||||
},
|
||||
"href": {
|
||||
"type": "text"
|
||||
},
|
||||
"executable": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
{
|
||||
"settings": {
|
||||
"analysis": {
|
||||
"normalizer": {
|
||||
"lowercase_normalizer": {
|
||||
"type": "custom",
|
||||
"char_filter": [],
|
||||
"filter": [
|
||||
"lowercase"
|
||||
]
|
||||
}
|
||||
},
|
||||
"analyzer": {
|
||||
"om_analyzer": {
|
||||
"tokenizer": "letter",
|
||||
"filter": [
|
||||
"lowercase",
|
||||
"om_stemmer"
|
||||
]
|
||||
},
|
||||
"om_analyzer_jp" : {
|
||||
"tokenizer" : "kuromoji_tokenizer",
|
||||
"type" : "custom",
|
||||
"filter" : [
|
||||
"kuromoji_baseform",
|
||||
"kuromoji_part_of_speech",
|
||||
"kuromoji_number",
|
||||
"kuromoji_stemmer"
|
||||
]
|
||||
},
|
||||
"om_ngram": {
|
||||
"tokenizer": "ngram",
|
||||
"min_gram": 1,
|
||||
"max_gram": 2,
|
||||
"filter": [
|
||||
"lowercase"
|
||||
]
|
||||
}
|
||||
},
|
||||
"filter": {
|
||||
"om_stemmer": {
|
||||
"type": "stemmer",
|
||||
"name": "english"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"name": {
|
||||
"type": "text",
|
||||
"analyzer": "om_analyzer_jp",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
},
|
||||
"ngram": {
|
||||
"type": "text",
|
||||
"analyzer": "om_ngram"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fullyQualifiedName": {
|
||||
"type": "keyword",
|
||||
"normalizer": "lowercase_normalizer"
|
||||
},
|
||||
"description": {
|
||||
"type": "text",
|
||||
"analyzer": "om_analyzer_jp",
|
||||
"fields": {
|
||||
"ngram": {
|
||||
"type": "text",
|
||||
"analyzer": "om_ngram"
|
||||
}
|
||||
}
|
||||
},
|
||||
"displayName": {
|
||||
"type": "text",
|
||||
"analyzer": "om_analyzer_jp",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"deleted": {
|
||||
"type": "text"
|
||||
},
|
||||
"href": {
|
||||
"type": "text"
|
||||
},
|
||||
"executable": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
{
|
||||
"settings": {
|
||||
"analysis": {
|
||||
"normalizer": {
|
||||
"lowercase_normalizer": {
|
||||
"type": "custom",
|
||||
"char_filter": [],
|
||||
"filter": [
|
||||
"lowercase"
|
||||
]
|
||||
}
|
||||
},
|
||||
"analyzer": {
|
||||
"om_analyzer": {
|
||||
"tokenizer": "letter",
|
||||
"filter": [
|
||||
"lowercase",
|
||||
"om_stemmer"
|
||||
]
|
||||
},
|
||||
"om_ngram": {
|
||||
"tokenizer": "ngram",
|
||||
"min_gram": 2,
|
||||
"max_gram": 3,
|
||||
"filter": [
|
||||
"lowercase"
|
||||
]
|
||||
}
|
||||
},
|
||||
"filter": {
|
||||
"om_stemmer": {
|
||||
"type": "stemmer",
|
||||
"name": "english"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"name": {
|
||||
"type": "text",
|
||||
"analyzer": "ik_max_word",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
},
|
||||
"ngram": {
|
||||
"type": "text",
|
||||
"analyzer": "om_ngram"
|
||||
}
|
||||
}
|
||||
},
|
||||
"fullyQualifiedName": {
|
||||
"type": "keyword",
|
||||
"normalizer": "lowercase_normalizer"
|
||||
},
|
||||
"description": {
|
||||
"type": "text",
|
||||
"analyzer": "ik_max_word",
|
||||
"fields": {
|
||||
"ngram": {
|
||||
"type": "text",
|
||||
"analyzer": "om_ngram"
|
||||
}
|
||||
}
|
||||
},
|
||||
"displayName": {
|
||||
"type": "text",
|
||||
"analyzer": "ik_max_word",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"deleted": {
|
||||
"type": "text"
|
||||
},
|
||||
"href": {
|
||||
"type": "text"
|
||||
},
|
||||
"executable": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user