Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
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 ddf47be3
authored
Mar 09, 2021
by
leejoker
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改判断方式
1 parent
afef9837
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
linkwe-common/src/main/java/com/linkwechat/common/core/elasticsearch/ElasticSearch.java
linkwe-common/src/main/java/com/linkwechat/common/core/elasticsearch/ElasticSearch.java
View file @
ddf47be
...
@@ -208,7 +208,7 @@ public class ElasticSearch {
...
@@ -208,7 +208,7 @@ public class ElasticSearch {
list
.
forEach
(
item
->
request
.
add
(
new
IndexRequest
(
idxName
,
"_doc"
).
id
(
item
.
getId
())
list
.
forEach
(
item
->
request
.
add
(
new
IndexRequest
(
idxName
,
"_doc"
).
id
(
item
.
getId
())
.
source
(
item
.
getData
(),
XContentType
.
JSON
)));
.
source
(
item
.
getData
(),
XContentType
.
JSON
)));
try
{
try
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
request
.
requests
()
))
{
restHighLevelClient
.
bulk
(
request
,
RequestOptions
.
DEFAULT
);
restHighLevelClient
.
bulk
(
request
,
RequestOptions
.
DEFAULT
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -228,7 +228,7 @@ public class ElasticSearch {
...
@@ -228,7 +228,7 @@ public class ElasticSearch {
list
.
parallelStream
().
forEach
(
item
->
request
.
add
(
new
IndexRequest
(
idxName
,
"_doc"
).
id
(
item
.
getId
())
list
.
parallelStream
().
forEach
(
item
->
request
.
add
(
new
IndexRequest
(
idxName
,
"_doc"
).
id
(
item
.
getId
())
.
source
(
item
.
getData
(),
XContentType
.
JSON
)));
.
source
(
item
.
getData
(),
XContentType
.
JSON
)));
try
{
try
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
request
.
requests
()
))
{
restHighLevelClient
.
bulkAsync
(
request
,
RequestOptions
.
DEFAULT
,
getActionListener
(
consumer
,
list
,
param
));
restHighLevelClient
.
bulkAsync
(
request
,
RequestOptions
.
DEFAULT
,
getActionListener
(
consumer
,
list
,
param
));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -241,7 +241,7 @@ public class ElasticSearch {
...
@@ -241,7 +241,7 @@ public class ElasticSearch {
list
.
parallelStream
().
forEach
(
item
->
request
.
add
(
new
IndexRequest
(
idxName
,
"_doc"
).
id
(
item
.
getString
(
"msgid"
))
list
.
parallelStream
().
forEach
(
item
->
request
.
add
(
new
IndexRequest
(
idxName
,
"_doc"
).
id
(
item
.
getString
(
"msgid"
))
.
source
(
item
,
XContentType
.
JSON
)));
.
source
(
item
,
XContentType
.
JSON
)));
try
{
try
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
request
.
requests
()
))
{
restHighLevelClient
.
bulkAsync
(
request
,
RequestOptions
.
DEFAULT
,
getActionListener
(
consumer
,
list
));
restHighLevelClient
.
bulkAsync
(
request
,
RequestOptions
.
DEFAULT
,
getActionListener
(
consumer
,
list
));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -253,7 +253,7 @@ public class ElasticSearch {
...
@@ -253,7 +253,7 @@ public class ElasticSearch {
BulkRequest
request
=
new
BulkRequest
();
BulkRequest
request
=
new
BulkRequest
();
list
.
forEach
(
item
->
request
.
add
(
new
UpdateRequest
(
idxName
,
item
.
getId
()).
upsert
(
item
.
getData
(),
XContentType
.
JSON
)));
list
.
forEach
(
item
->
request
.
add
(
new
UpdateRequest
(
idxName
,
item
.
getId
()).
upsert
(
item
.
getData
(),
XContentType
.
JSON
)));
try
{
try
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
request
.
requests
()
))
{
restHighLevelClient
.
bulk
(
request
,
RequestOptions
.
DEFAULT
);
restHighLevelClient
.
bulk
(
request
,
RequestOptions
.
DEFAULT
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -277,7 +277,7 @@ public class ElasticSearch {
...
@@ -277,7 +277,7 @@ public class ElasticSearch {
BulkRequest
request
=
new
BulkRequest
();
BulkRequest
request
=
new
BulkRequest
();
idList
.
forEach
(
item
->
request
.
add
(
new
DeleteRequest
(
idxName
,
"_doc"
,
item
.
toString
())));
idList
.
forEach
(
item
->
request
.
add
(
new
DeleteRequest
(
idxName
,
"_doc"
,
item
.
toString
())));
try
{
try
{
if
(!
CollectionUtils
.
isEmpty
(
idList
))
{
if
(!
CollectionUtils
.
isEmpty
(
request
.
requests
()
))
{
restHighLevelClient
.
bulk
(
request
,
RequestOptions
.
DEFAULT
);
restHighLevelClient
.
bulk
(
request
,
RequestOptions
.
DEFAULT
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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