Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0d971952
authored
Feb 26, 2024
by
罗志长
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: keepalive
parent
1faa04b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
server-common/src/main/java/com/makeit/config/es/ElasticSearchClientConfig.java
server-common/src/main/java/com/makeit/config/es/ElasticSearchClientConfig.java
View file @
0d971952
...
@@ -2,6 +2,7 @@ package com.makeit.config.es;
...
@@ -2,6 +2,7 @@ package com.makeit.config.es;
import
org.apache.http.HttpHost
;
import
org.apache.http.HttpHost
;
import
org.elasticsearch.client.RestClient
;
import
org.elasticsearch.client.RestClient
;
import
org.elasticsearch.client.RestClientBuilder
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -14,11 +15,9 @@ public class ElasticSearchClientConfig {
...
@@ -14,11 +15,9 @@ public class ElasticSearchClientConfig {
@Bean
(
name
=
"restHighLevelClient"
)
@Bean
(
name
=
"restHighLevelClient"
)
public
RestHighLevelClient
restHighLevelClient
()
{
public
RestHighLevelClient
restHighLevelClient
()
{
return
new
RestHighLevelClient
(
RestClientBuilder
builder
=
RestClient
.
builder
(
new
HttpHost
(
es
.
getHost
(),
es
.
getPort
(),
es
.
getScheme
()))
RestClient
.
builder
(
.
setHttpClientConfigCallback
(
httpClientBuilder
->
httpClientBuilder
.
setKeepAliveStrategy
((
httpResponse
,
httpContext
)
->
1000
*
60
));
new
HttpHost
(
es
.
getHost
(),
es
.
getPort
(),
es
.
getScheme
())
return
new
RestHighLevelClient
(
builder
);
)
);
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment