Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nest - undocmented breaking change - 0.0.0.12 to 1.0 beta 1 - BulkResponse.Items OK #616

Closed
crunchie84 opened this issue Apr 23, 2014 · 2 comments

Comments

@crunchie84
Copy link

You can no longer find out if any items have failed indexing from within the IBulkResponse

0.0.0.12 syntax:

var itemsWhichFailedToIndex = IBulkResponse.Items.Where(i => !i.OK)

Please advice how to fix this?

@danblair
Copy link

I ran into this also yesterday. I've added an additional check of seeing if an Error exists also.

results.Items.Where(x => x != null && !x.OK && !String.IsNullOrWhiteSpace(x.Error))

So far it seems to work. Also, it's important to note that the index was being updated in my case even though OK was returning false.

@Mpdreamz
Copy link
Member

Looking for invalid items is now a lot easier:

var result = this._client.Bulk(b => b
    .Create<ElasticsearchProject>(i => i.Object(new ElasticsearchProject { Id = 123123 }))
    .Create<ElasticsearchProject>(i => i.Object(new ElasticsearchProject { Id = 123123 }))
);

result.IsValid.Should().BeFalse();
result.Errors.Should().BeTrue();
result.ItemsWithErrors.Should().NotBeEmpty().And.HaveCount(1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants