Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
VVAS-Match
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 25c5f0d6
authored
Jan 26, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加刷新机制
1 parent
b641d4d3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/service/PoolService.java
src/main/java/com/viontech/match/service/PersonService.java
View file @
25c5f0d
...
...
@@ -175,7 +175,9 @@ public class PersonService {
if
(
bulkRequest
.
requests
().
size
()
==
0
)
{
return
null
;
}
return
client
.
bulk
(
bulkRequest
,
RequestOptions
.
DEFAULT
);
BulkResponse
bulk
=
client
.
bulk
(
bulkRequest
,
RequestOptions
.
DEFAULT
);
poolService
.
refreshPool
(
poolId
);
return
bulk
;
}
/**
...
...
src/main/java/com/viontech/match/service/PoolService.java
View file @
25c5f0d
...
...
@@ -10,6 +10,8 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.http.HttpEntity
;
import
org.elasticsearch.ElasticsearchStatusException
;
import
org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest
;
import
org.elasticsearch.action.admin.indices.refresh.RefreshRequest
;
import
org.elasticsearch.action.admin.indices.refresh.RefreshResponse
;
import
org.elasticsearch.action.bulk.BulkResponse
;
import
org.elasticsearch.action.support.master.AcknowledgedResponse
;
import
org.elasticsearch.client.*
;
...
...
@@ -170,6 +172,12 @@ public class PoolService {
}
}
public
void
refreshPool
(
String
...
poolIds
)
throws
IOException
{
RefreshRequest
refreshRequest
=
new
RefreshRequest
(
poolIds
);
RefreshResponse
refresh
=
client
.
indices
().
refresh
(
refreshRequest
,
RequestOptions
.
DEFAULT
);
log
.
info
(
"刷新索引:{},成功:{},失败:{}"
,
poolIds
,
refresh
.
getSuccessfulShards
(),
refresh
.
getFailedShards
());
}
public
XContentBuilder
getCreateIndexContentBuilder
()
throws
IOException
{
XContentBuilder
builder
=
XContentFactory
.
jsonBuilder
();
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment