Open syhily opened 4 months ago
Hello, thanks for reporting this! Yes it seems like the serializer is ignoring the action field, we'll investigate this.
Ran into something similar where it strongly depends on how I set the action of the UpdateOperation in a BulkRequest.
I have a pre-serialized JSON which I set like this:
BinaryData binaryData = BinaryData.of(jsonBytes, contentType);
UpdateOperation.of(uo -> uo.index(index).id(id)
.action(UpdateAction.of(ua -> ua.doc(binaryData)));
but the resulting section in the request body just looks like: {"doc":{"repeatable":true}}
If I first deserialize my JSON into a Map to get rid of the BinaryData it works:
HashMap<String, Object> map = // deserialize JSON...
UpdateOperation.of(uo -> uo.index(index).id(id)
.action(UpdateAction.of(ua -> ua.doc(map))));
resulting in: {"doc":{"my_field": "some value"}}
Java API client version
8.13.2
Java version
17
Elasticsearch Version
8.11.3
Problem description
I use some code like below to a script execution request in the bulk update operation.
The action part didn't get serialized into the final request body.