elastic / elastic/elasticsearch-java

Throw Exception while using withJson method in bulk.IndexOperation

Open
#1,083 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
524
Forks
300
Avg merge
1d 11h
Merged PRs (30d)
16

Description

### Java API client version

9.1.5

### Java version

21

### Elasticsearch Version

9.1.5

### Problem description

Hi, I noticed this might be an issue that was reported before.
I've confirmed that it seems to be reproducible even in the latest version.
If this is an unintended error and no one is currently assigned to it, would it be okay if I try to work on it?

Code

```Java
final BulkResponse response = client.bulk(br -> br.operations(
bo -> bo.index(io -> io.withJson(jsonInputStream).index("test").id("1"))
));
```

Error
```
Class class co.elastic.clients.elasticsearch.core.bulk.IndexOperation cannot be read from JSON
java.lang.IllegalArgumentException: Class class co.elastic.clients.elasticsearch.core.bulk.IndexOperation cannot be read from JSON
at co.elastic.clients.util.WithJsonObjectBuilderBase.withJson(WithJsonObjectBuilderBase.java:46)
at co.elastic.clients.json.WithJson.withJson(WithJson.java:43)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.