use of org.codelibs.fess.es.client.FessEsClientException in project fess by codelibs.
the class SearchService method update.
public boolean update(final String id, final Consumer<UpdateRequestBuilder> builderLambda) {
try {
final UpdateRequestBuilder builder = fessEsClient.prepareUpdate(fessConfig.getIndexDocumentUpdateIndex(), fessConfig.getIndexDocumentType(), id);
builderLambda.accept(builder);
final UpdateResponse response = builder.execute().actionGet(fessConfig.getIndexIndexTimeout());
return response.getResult() == Result.CREATED || response.getResult() == Result.UPDATED;
} catch (final ElasticsearchException e) {
throw new FessEsClientException("Failed to update doc " + id, e);
}
}
use of org.codelibs.fess.es.client.FessEsClientException in project fess by codelibs.
the class SearchService method bulkUpdate.
public boolean bulkUpdate(final Consumer<BulkRequestBuilder> consumer) {
final BulkRequestBuilder builder = fessEsClient.prepareBulk();
consumer.accept(builder);
try {
final BulkResponse response = builder.execute().get();
if (response.hasFailures()) {
throw new FessEsClientException(response.buildFailureMessage());
} else {
return true;
}
} catch (InterruptedException | ExecutionException e) {
throw new FessEsClientException("Failed to update bulk data.", e);
}
}
Aggregations