Java Code Examples for org.elasticsearch.action.bulk.BulkItemResponse#getFailureMessage()
The following examples show how to use
org.elasticsearch.action.bulk.BulkItemResponse#getFailureMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ESTemplate.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
/** * 提交批次 */ public void commit() { if (getBulk().numberOfActions() > 0) { BulkResponse response = getBulk().execute().actionGet(); if (response.hasFailures()) { for (BulkItemResponse itemResponse : response.getItems()) { if (!itemResponse.isFailed()) { continue; } if (itemResponse.getFailure().getStatus() == RestStatus.NOT_FOUND) { logger.error(itemResponse.getFailureMessage()); } else { throw new RuntimeException("ES sync commit error" + itemResponse.getFailureMessage()); } } } } }
Example 2
Source File: Elasticsearch1ApiCallBridge.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public Throwable extractFailureCauseFromBulkItemResponse(BulkItemResponse bulkItemResponse) { if (!bulkItemResponse.isFailed()) { return null; } else { return new RuntimeException(bulkItemResponse.getFailureMessage()); } }
Example 3
Source File: ESEtlService.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
private void processFailBulkResponse(BulkResponse bulkResponse) { for (BulkItemResponse response : bulkResponse.getItems()) { if (!response.isFailed()) { continue; } if (response.getFailure().getStatus() == RestStatus.NOT_FOUND) { logger.warn(response.getFailureMessage()); } else { logger.error("全量导入数据有误 {}", response.getFailureMessage()); throw new RuntimeException("全量数据 etl 异常: " + response.getFailureMessage()); } } }
Example 4
Source File: ElasticIndexWriter.java From nutch-htmlunit with Apache License 2.0 | 5 votes |
@Override public void commit() throws IOException { if (execute != null) { // wait for previous to finish long beforeWait = System.currentTimeMillis(); BulkResponse actionGet = execute.actionGet(); if (actionGet.hasFailures()) { for (BulkItemResponse item : actionGet) { if (item.isFailed()) { throw new RuntimeException("First failure in bulk: " + item.getFailureMessage()); } } } long msWaited = System.currentTimeMillis() - beforeWait; LOG.info("Previous took in ms " + actionGet.getTookInMillis() + ", including wait " + msWaited); execute = null; } if (bulk != null) { if (bulkDocs > 0) { // start a flush, note that this is an asynchronous call execute = bulk.execute(); } bulk = null; } if (createNewBulk) { // Prepare a new bulk request bulk = client.prepareBulk(); bulkDocs = 0; bulkLength = 0; } }
Example 5
Source File: ESConnection.java From canal with Apache License 2.0 | 5 votes |
@Override public void processFailBulkResponse(String errorMsg) { for (BulkItemResponse itemResponse : bulkResponse.getItems()) { if (!itemResponse.isFailed()) { continue; } if (itemResponse.getFailure().getStatus() == RestStatus.NOT_FOUND) { logger.error(itemResponse.getFailureMessage()); } else { throw new RuntimeException(errorMsg + itemResponse.getFailureMessage()); } } }
Example 6
Source File: ESConnection.java From canal with Apache License 2.0 | 5 votes |
@Override public void processFailBulkResponse(String errorMsg) { for (BulkItemResponse itemResponse : bulkResponse.getItems()) { if (!itemResponse.isFailed()) { continue; } if (itemResponse.getFailure().getStatus() == RestStatus.NOT_FOUND) { logger.error(itemResponse.getFailureMessage()); } else { throw new RuntimeException(errorMsg + itemResponse.getFailureMessage()); } } }