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

[BUG] Bulk Update Request fails due to inconsistent request body generated by the Java Client #376

Closed
tnahddisttud opened this issue Feb 22, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@tnahddisttud
Copy link

tnahddisttud commented Feb 22, 2023

Using the Java API Client’s (version: 2.2.0) BulkRequest.Builder and UpdateOperation.Builder for building bulk update requests behaves differently as compared to bulk operation documentation . Because of this attempting to perform the bulk-update operations using the Java Client results in a [x_content_parse_exception]

Built a Bulk request using the following code:

BulkRequest.Builder bulkRequestBuilder = new BulkRequest.Builder();
    ids.forEach(
        id -> {
          UpdateOperation<Movie> updateOperation =
              new UpdateOperation.Builder<Movie>()
                  .index(movie-index)
                  .id(id)
                  .document(Movie.builder().isDeleted(true).build())
                  .build();
          bulkRequest.operations(o -> o.update(updateOperation));
        });
BulkRequest bulkRequest = bulkRequestBuilder.build();

The request body being created is:

{"update":{"_id":"f1096b","_index":"movie-index"}}
{"isDeleted":true}

But as per the documentation it should look like this:

{"update":{"_id":"f1096b","_index":"movie-index"}}
{ "doc" : {"isDeleted":true}}
@tnahddisttud tnahddisttud added bug Something isn't working untriaged labels Feb 22, 2023
@tnahddisttud tnahddisttud changed the title [BUG] Bulk Update Request inconsistent with the documentation, throws [x_content_parse_exception] [BUG] Bulk Update Request fails due to inconsistent request body generated by the Java Client, throws [x_content_parse_exception] Feb 22, 2023
@tnahddisttud tnahddisttud changed the title [BUG] Bulk Update Request fails due to inconsistent request body generated by the Java Client, throws [x_content_parse_exception] [BUG] Bulk Update Request fails due to inconsistent request body generated by the Java Client Feb 22, 2023
@wbeckler
Copy link

This is a good catch. Feel free to offer a PR of a failing test and if you're up for it, a fix.

@tnahddisttud
Copy link
Author

tnahddisttud commented Feb 27, 2023

Hello @wbeckler,
Upon working on the test case, I came to realize that it had already been attended to by #358 and subsequently incorporated into the main branch, so we can close this issue. Would you happen to know when we can expect a new release containing this patch?

@dblock
Copy link
Member

dblock commented Feb 28, 2023

Lets close this. I saw @VachaShah signed up to do a release :)

@VachaShah
Copy link
Collaborator

Lets close this. I saw @VachaShah signed up to do a release :)

Yes tracking the release in #380 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants