mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-06-27 04:22:05 +00:00
fixed migrate-all issue in search (#13667)
* fixed migrate-all issue in search * re-run checks * re-run checks * fix checkstyle
This commit is contained in:
parent
cc5b4d8251
commit
2454da18fd
@ -21,6 +21,7 @@ import static org.openmetadata.service.search.EntityBuilderConstant.SCHEMA_FIELD
|
|||||||
import static org.openmetadata.service.search.EntityBuilderConstant.UNIFIED;
|
import static org.openmetadata.service.search.EntityBuilderConstant.UNIFIED;
|
||||||
import static org.openmetadata.service.search.UpdateSearchEventsConstant.SENDING_REQUEST_TO_ELASTIC_SEARCH;
|
import static org.openmetadata.service.search.UpdateSearchEventsConstant.SENDING_REQUEST_TO_ELASTIC_SEARCH;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import es.org.elasticsearch.action.ActionListener;
|
import es.org.elasticsearch.action.ActionListener;
|
||||||
import es.org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
import es.org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||||
import es.org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
import es.org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||||
@ -232,7 +233,8 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
public void updateIndex(IndexMapping indexMapping, String indexMappingContent) {
|
public void updateIndex(IndexMapping indexMapping, String indexMappingContent) {
|
||||||
try {
|
try {
|
||||||
PutMappingRequest request = new PutMappingRequest(indexMapping.getIndexName());
|
PutMappingRequest request = new PutMappingRequest(indexMapping.getIndexName());
|
||||||
request.source(indexMappingContent, XContentType.JSON);
|
JsonNode readProperties = JsonUtils.readTree(indexMappingContent).get("mappings");
|
||||||
|
request.source(JsonUtils.getMap(readProperties));
|
||||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||||
LOG.debug("{} Updated {}", indexMapping.getIndexMappingFile(), putMappingResponse.isAcknowledged());
|
LOG.debug("{} Updated {}", indexMapping.getIndexMappingFile(), putMappingResponse.isAcknowledged());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -21,6 +21,7 @@ import static org.openmetadata.service.search.EntityBuilderConstant.SCHEMA_FIELD
|
|||||||
import static org.openmetadata.service.search.EntityBuilderConstant.UNIFIED;
|
import static org.openmetadata.service.search.EntityBuilderConstant.UNIFIED;
|
||||||
import static org.openmetadata.service.search.UpdateSearchEventsConstant.SENDING_REQUEST_TO_ELASTIC_SEARCH;
|
import static org.openmetadata.service.search.UpdateSearchEventsConstant.SENDING_REQUEST_TO_ELASTIC_SEARCH;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -225,7 +226,8 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
public void updateIndex(IndexMapping indexMapping, String indexMappingContent) {
|
public void updateIndex(IndexMapping indexMapping, String indexMappingContent) {
|
||||||
try {
|
try {
|
||||||
PutMappingRequest request = new PutMappingRequest(indexMapping.getIndexName());
|
PutMappingRequest request = new PutMappingRequest(indexMapping.getIndexName());
|
||||||
request.source(indexMappingContent, XContentType.JSON);
|
JsonNode readProperties = JsonUtils.readTree(indexMappingContent).get("mappings");
|
||||||
|
request.source(JsonUtils.getMap(readProperties));
|
||||||
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||||
LOG.debug("{} Updated {}", indexMapping.getIndexMappingFile(), putMappingResponse.isAcknowledged());
|
LOG.debug("{} Updated {}", indexMapping.getIndexMappingFile(), putMappingResponse.isAcknowledged());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
package elasticsearch;
|
package elasticsearch;
|
||||||
|
|
||||||
public class ElasticSearchNoop {
|
public class ElasticSearchNoop {}
|
||||||
}
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
package opensearch;
|
package opensearch;
|
||||||
|
|
||||||
public class OpenSearchNoop {
|
public class OpenSearchNoop {}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user