Commit 38e21428 authored by Darshan M N's avatar Darshan M N
Browse files

Reversing the alternate entry changes

Showing with 2 additions and 7 deletions
+2 -7
......@@ -64,14 +64,12 @@ public class ElasticSearchRepository {
private AppConfiguration appConfig;
private RestHighLevelClient client;
private RestHighLevelClient client2;
@Autowired
private ElasticSearchRepository(AppConfiguration appConfiguration, RestTemplate restTemp) {
appConfig = appConfiguration;
restTemplate = restTemp;
client = connectToElasticSearch();
client2 = connectToElasticSearch2();
}
private RestHighLevelClient connectToElasticSearch() {
......@@ -93,7 +91,7 @@ public class ElasticSearchRepository {
private RestHighLevelClient connectToElasticSearch2() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials("elastic", "PuAz@itAqwsaR34bYu"));
new UsernamePasswordCredentials("username", "password"));
HttpClientConfigCallback httpClientConfigCallback = new HttpClientConfigCallback() {
@Override
......@@ -102,7 +100,7 @@ public class ElasticSearchRepository {
}
};
return new RestHighLevelClient(
RestClient.builder(new HttpHost("elastic.pulz.app",443, "https"))
RestClient.builder(new HttpHost("hostname",443, "https"))
.setHttpClientConfigCallback(httpClientConfigCallback));
}
......@@ -141,7 +139,6 @@ public class ElasticSearchRepository {
IndexRequest indexRequest = new IndexRequest(indexName, documentType, id).source(new Gson().toJson(object),
XContentType.JSON);
IndexResponse response = client.index(indexRequest, RequestOptions.DEFAULT);
client2.index(indexRequest, RequestOptions.DEFAULT);
if (!StringUtils.isBlank(response.toString()))
LOGGER.info("Response : {}", response);
} catch (Exception e) {
......@@ -157,7 +154,6 @@ public class ElasticSearchRepository {
UpdateRequest updateRequest = new UpdateRequest(indexName, documentType, id).doc(new Gson().toJson(object),
XContentType.JSON);
UpdateResponse response = client.update(updateRequest, RequestOptions.DEFAULT);
client2.update(updateRequest, RequestOptions.DEFAULT);
if (!StringUtils.isBlank(response.toString()))
LOGGER.info("Updated Response : {}", response.getResult());
} catch (Exception e) {
......@@ -170,7 +166,6 @@ public class ElasticSearchRepository {
public Boolean writeBulkDatatoElastic(BulkRequest request) throws IOException {
try {
BulkResponse response = client.bulk(request, RequestOptions.DEFAULT);
client2.bulk(request, RequestOptions.DEFAULT);
if (!StringUtils.isBlank(response.toString()))
LOGGER.info("Response : {}", response);
} catch (Exception e) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment