Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-form
Commits
38e21428
Commit
38e21428
authored
3 years ago
by
Darshan M N
Browse files
Options
Download
Patches
Plain Diff
Reversing the alternate entry changes
parent
1e17dbbf
master
bulk-download
cvs_download
delete-form
emailContentUpdate
inspection-flow-changes
institute-district
lat-long
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/tarento/formservice/repository/ElasticSearchRepository.java
+2
-7
...rento/formservice/repository/ElasticSearchRepository.java
with
2 additions
and
7 deletions
+2
-7
src/main/java/com/tarento/formservice/repository/ElasticSearchRepository.java
+
2
−
7
View file @
38e21428
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets