log when failing to process doc after index operation

This commit is contained in:
kimchy 2011-04-19 16:13:26 +03:00
parent 79ebcc31c5
commit f8ff42d397
2 changed files with 7 additions and 5 deletions

View File

@ -222,10 +222,9 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
try {
PercolatorExecutor.Response percolate = indexService.percolateService().percolate(new PercolatorExecutor.DocAndSourceQueryRequest(op.parsedDoc(), indexRequest.percolate()));
((IndexResponse) itemResponse.response()).matches(percolate.matches());
op.docMapper().processDocumentAfterIndex(op.doc());
} catch (Exception e) {
logger.warn("failed to percolate [{}]", e, itemRequest.request());
} finally {
op.docMapper().processDocumentAfterIndex(op.doc());
}
}
}

View File

@ -212,17 +212,20 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi
@Override protected void postPrimaryOperation(IndexRequest request, PrimaryResponse<IndexResponse> response) {
Engine.IndexingOperation op = (Engine.IndexingOperation) response.payload();
if (!Strings.hasLength(request.percolate())) {
op.docMapper().processDocumentAfterIndex(op.doc());
try {
op.docMapper().processDocumentAfterIndex(op.doc());
} catch (Exception e) {
logger.warn("failed to cleanup doc after index [{}]", e, request);
}
return;
}
IndexService indexService = indicesService.indexServiceSafe(request.index());
try {
PercolatorExecutor.Response percolate = indexService.percolateService().percolate(new PercolatorExecutor.DocAndSourceQueryRequest(op.parsedDoc(), request.percolate()));
response.response().matches(percolate.matches());
op.docMapper().processDocumentAfterIndex(op.doc());
} catch (Exception e) {
logger.warn("failed to percolate [{}]", e, request);
} finally {
op.docMapper().processDocumentAfterIndex(op.doc());
}
}