|
|
@@ -38,10 +38,11 @@ public class DocumentService {
|
|
|
|
|
|
public void batchAddDocument(String indexName, List<NginxLog> nginxLogs) throws IOException {
|
|
|
List<BulkOperation> bulkOperations = new ArrayList<>();
|
|
|
- nginxLogs.forEach(p -> bulkOperations.add(BulkOperation.of(b -> b.index(c -> c.id(p.getId()).document(p)))));
|
|
|
+ nginxLogs.forEach(p -> bulkOperations.add(BulkOperation.of(b -> b.index(c -> c.document(p)))));
|
|
|
BulkResponse bulkResponse = esClient.bulk(s -> s.index(indexName).operations(bulkOperations));
|
|
|
- //bulkResponse.items().forEach(b -> log.info("bulk response result = {}", b.result()));
|
|
|
- //log.error("bulk response.error() = {}", bulkResponse.errors());
|
|
|
+ if (bulkResponse.errors()) {
|
|
|
+ bulkResponse.items().forEach(b -> log.error("bulk response result = {}", b.result()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void batchAddWenshu(String indexName, List<Wenshu> wenshuList) throws IOException {
|