# Issue with opensearch client

**URL:** <https://forum.opensearch.org/t/issue-with-opensearch-client/21409>\
**Category:** OpenSearch Client Libraries\
**Tags:** opensearch-java\
**Created:** [September 12, 2024, 7:50am UTC](https://forum.opensearch.org/t/issue-with-opensearch-client/21409 "2024-09-12T07:50:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabinvallet](https://avatars.discourse-cdn.com/v4/letter/g/b782af/32.png) [@gabinvallet](https://forum.opensearch.org/u/gabinvallet)\
**Post date:** [September 12, 2024, 7:50am UTC](https://forum.opensearch.org/t/issue-with-opensearch-client/21409/1 "2024-09-12T07:50:57Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
Opensearch 2.14.0  
opensearch-java 2.14.0 (but I’ve tried several versions, was 2.11.1 at first)  
opensearch-rest-client 2.16.0 (but I’ve tried several versions, was 2.8.3 at first)

**Describe the issue** :  
Hello,  
A while back, I’ve created a topic on this forum regarding a particular issue:

> [@How to get the reindexation tasks with java opensearch client?](https://forum.opensearch.org/t/how-to-get-the-reindexation-tasks-with-java-opensearch-client/17376):
>
> Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): Opensearch 2.4.1 opensearch-java 2.8.1 opensearch test-containers 2.0.1 opensearch-rest-client 2.11.1 Describe the issue: Hello everyone, First of all, I wish you a happy new year ! As for the matter at hand, I am currently trying to reduce the size of our opensearch, as it has gotten quite consequent over the years. To do so, I have a java 21 application that will get the list of all our indexes, and reindex them one at a tim…

To sum it up here, I have an application that will basically reindex data from one mapping to another one. To check that my reindexation occured properly, I want to use the tasks API to be able to check that the reindexation of one index succeeded, before moving on to the next one.  
To do so, I use the response from my previous post (retrieving the tasksId, and then using it to retrieve the next one, I just use GetTasksRequest and GetTasksResponse) and it used to work perfectly:  
GetTasksRequest getTasksRequest = new GetTasksRequest.Builder().taskId(migrationIndex.getTaskId()).build();  
GetTasksResponse getTasksResponse = elasticsearchConnector.client.tasks().get(getTasksRequest);  
return getTasksResponse.completed();

I hadn’t started the project in a few months, and a few days ago, I restarted it and noticed that this specific request now fails everytime a task is completed (but when the task is still ongoing, it seems to be working just fine), almost as if the tasks API responds a message that’s not compatible with the java client.  
I’ll put the error message in the screenshots part.

A few precisions:

- When I request in the devtool of opensearch dashboard I retrieve the task properly.
- In my test containers, it works fine too

So if someone knows why this now doesn’t work anymore it would help a lot, thanks for any clue you might give me

**Relevant Logs or Screenshots** :

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/9/90a95e3e41528ff4d02c27ca7bb256d210e7d840.png)

---

<div class="post-metadata">

**Author:** ![reta](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@reta](https://forum.opensearch.org/u/reta)\
**Post date:** [September 12, 2024, 1:27pm UTC](https://forum.opensearch.org/t/issue-with-opensearch-client/21409/2 "2024-09-12T13:27:39Z")

</div>

@gabinvallet please check [[BUG] UnexpectedJsonEventException reading task that failed · Issue #666 · opensearch-project/opensearch-java · GitHub](https://github.com/opensearch-project/opensearch-java/issues/666)

---

<div class="post-metadata">

**Author:** ![gabinvallet](https://avatars.discourse-cdn.com/v4/letter/g/b782af/32.png) [@gabinvallet](https://forum.opensearch.org/u/gabinvallet)\
**Post date:** [September 12, 2024, 2:03pm UTC](https://forum.opensearch.org/t/issue-with-opensearch-client/21409/3 "2024-09-12T14:03:53Z")

</div>

Thanks for your answer Reta, if I understand correctly it means that this issue is stuck for now right ?

---

<div class="post-metadata">

**Author:** ![reta](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@reta](https://forum.opensearch.org/u/reta)\
**Post date:** [September 12, 2024, 3:18pm UTC](https://forum.opensearch.org/t/issue-with-opensearch-client/21409/4 "2024-09-12T15:18:37Z")

</div>

Probably better to say, not fixed but help is very welcome.

---

<div class="post-metadata">

**Author:** ![gabinvallet](https://avatars.discourse-cdn.com/v4/letter/g/b782af/32.png) [@gabinvallet](https://forum.opensearch.org/u/gabinvallet)\
**Post date:** [September 12, 2024, 3:38pm UTC](https://forum.opensearch.org/t/issue-with-opensearch-client/21409/5 "2024-09-12T15:38:17Z")

</div>

Okay thanks for your answer, I’ll check more into details if I have some time 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [November 11, 2024, 3:38pm UTC](https://forum.opensearch.org/t/issue-with-opensearch-client/21409/6 "2024-11-11T15:38:33Z")

</div>

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