Java api bulk opreration

hello,I'm a student , and learning elasticsearch recently. when I use the java bulk api follow the official guides as Bulk: indexing multiple documents | Elasticsearch Java API Client [8.3] | Elastic. but it's occured a error :

co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/bulk] failed: [illegal_argument_exception] Malformed action/metadata line [3], expected START_OBJECT but found [VALUE_STRING]
at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:282) ~[elasticsearch-java-8.5.1.jar:na]
at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:148) ~[elasticsearch-java-8.5.1.jar:na]
at co.elastic.clients.elasticsearch.ElasticsearchClient.bulk(ElasticsearchClient.java:319) ~[elasticsearch-java-8.5.1.jar:na]

here is my code

my development environment is macos 10.14,es version is 8.5.2 and java 8.
I don't how to resolve the problem.If you know please help me . and meanwhile I want to know how to use the bulk api to update and delete document.
thanks.

Welcome!

Hard to say as we can't see your code. Most likely your json content is wrong.
Also please use the latest version 8.9.2.

Thank you sir, I have solved the problem, It was my fault,I injected a wrong ObjectMapper into Spring bean Context, it deserialize my Object in a weird way.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.