Search in sources :

Example 1 with BulkResponseItem

use of co.elastic.clients.elasticsearch.core.bulk.BulkResponseItem in project core-ng-project by neowu.

the class ElasticSearchTypeImpl method validate.

private void validate(BulkResponse response) {
    if (!response.errors())
        return;
    var builder = new CodeBuilder();
    builder.append("bulk operation failed, errors=[\n");
    for (BulkResponseItem item : response.items()) {
        ErrorCause error = item.error();
        if (error != null) {
            builder.append("id={}, error={}, stackTrace={}\n", item.id(), error.reason(), error.stackTrace());
        }
    }
    builder.append("]");
    throw new SearchException(builder.build());
}
Also used : BulkResponseItem(co.elastic.clients.elasticsearch.core.bulk.BulkResponseItem) ErrorCause(co.elastic.clients.elasticsearch._types.ErrorCause) SearchException(core.framework.search.SearchException) CodeBuilder(core.framework.internal.asm.CodeBuilder)

Aggregations

ErrorCause (co.elastic.clients.elasticsearch._types.ErrorCause)1 BulkResponseItem (co.elastic.clients.elasticsearch.core.bulk.BulkResponseItem)1 CodeBuilder (core.framework.internal.asm.CodeBuilder)1 SearchException (core.framework.search.SearchException)1