I have elasticsearch 8.6.1 version installed. I'm trying to add data using java API client. Code snippet is :
restClient = restClientBuilder.build();
client = new ElasticsearchClient(new RestClientTransport(restClient, new JacksonJsonpMapper()));
// dummy data
Employee emp = new Employee("E01", (short)32, "Sunil Kumar");
try {
client.index(i -> i
.index("employee")
.id(emp.getEmpID())
.document(emp));
} catch (ElasticsearchException | IOException e) {}
But while performing basic index operation giving Error:
Unable to execute bulk request.
co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch._types.ShardStatistics: jakarta.json.JsonException: Unable to get
a JsonProvider. Check your classpath or thread context classloader. (JSON path: items[0]._shards.total) (line no=1, column no=155, offset=-1)
Following are depedency jars in classpath:
- elasticsearch-java-8.6.2.jar
- jackson-databind-2.12.3.jar
- jakarta.json-api-2.0.1.jar
Please help on how it can be resolved.