Commit afef9837 by leejoker

es批量操作,增加列表非空判断

1 parent 6710c8df
...@@ -208,7 +208,9 @@ public class ElasticSearch { ...@@ -208,7 +208,9 @@ 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)) {
restHighLevelClient.bulk(request, RequestOptions.DEFAULT); restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
}
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!