Missing try catch for es-migrate option

This commit is contained in:
mohitdeuex 2023-06-30 11:58:21 +05:30
parent a96b3ab5b4
commit f51781c32d
2 changed files with 28 additions and 23 deletions

View File

@ -254,6 +254,7 @@ public interface SearchClient {
@SneakyThrows
default void updateElasticSearchFailureStatus(String failedFor, String failureMessage) {
try {
long updateTime = Date.from(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant()).getTime();
String recordString =
getDao()
@ -278,5 +279,8 @@ public interface SearchClient {
ELASTIC_SEARCH_EXTENSION,
JsonUtils.pojoToJson(lastRecord),
originalLastUpdate);
} catch (Exception e) {
// Failure to update
}
}
}

View File

@ -211,6 +211,7 @@ public class ElasticSearchClientImpl implements SearchClient {
LOG.info("{} Updated {}", elasticSearchIndexType.indexName, putMappingResponse.isAcknowledged());
} else {
CreateIndexRequest request = new CreateIndexRequest(elasticSearchIndexType.indexName);
request.source(elasticSearchIndexMapping, XContentType.JSON);
CreateIndexResponse createIndexResponse = client.indices().create(request, RequestOptions.DEFAULT);
LOG.info("{} Created {}", elasticSearchIndexType.indexName, createIndexResponse.isAcknowledged());
}