get task status of forcemerge(wait_for_completion=false) results in error when task completed
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start at ElasticsearchTasksClient.get and the TaskStatus builder, then compare the completed force-merge JSON in the report with the generated response model. Reproduce the wait_for_completion=false flow against Elasticsearch 8.5.0 and verify that the completed response deserializes successfully without a response.batches field.
Written by the indexing model from the issue text.
Description
Java API client version
8.5.2
Java version
1.8
Elasticsearch Version
8.5.0
Problem description
when submit a force merge request with wait_for_completion=false, i got a taskid. and I use task id to query task status
logger.info("force merge taskId: {}", taskId);
boolean completed = false;
GetTasksResponse tasksResponse = null;
while (!completed) {
tasksResponse = client.tasks().get(t -> t.taskId(taskId));
completed = tasksResponse.completed();
logger.info("force merge task not completed yet");
try {
Thread.sleep(2 * 60_000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
all seems good when task is still running. but when task finally completes, get task response throws exception
Error deserializing co.elastic.clients.elasticsearch.tasks.GetTasksResponse: co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'TaskStatus.batches' (JSON path: response) (line no=1, column no=449, offset=-1)
at co.elastic.clients.json.JsonpMappingException.from0(JsonpMappingException.java:134)
at co.elastic.clients.json.JsonpMappingException.from(JsonpMappingException.java:121)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:218)
at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:148)
at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:76)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.transport.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:325)
at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:295)
at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:148)
at co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksClient.get(ElasticsearchTasksClient.java:117)
at co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksClient.get(ElasticsearchTasksClient.java:133)
and the completed response json string should be something like this
{
"completed": true,
"task": {
"node": "xD7kSXXeSXWMURif3cX16w",
"id": 2180131,
"type": "transport",
"action": "indices:admin/forcemerge",
"description": "Force-merge indices [xxx], maxSegments[1], onlyExpungeDeletes[false], flush[true]",
"start_time_in_millis": 1671621375383,
"running_time_in_nanos": 9551767091603,
"cancellable": false,
"headers": {}
},
"response": {
"_shards": {
"total": 6,
"successful": 6,
"failed": 0
}
}
}
no response.batches exists however batches is force required in TaskStatus of the client code
private TaskStatus(Builder builder) {
this.batches = ApiTypeHelper.requireNonNull(builder.batches, this, "batches");
...
}
i think this a bug not related to https://github.com/elastic/elasticsearch-specification/issues/1767, so i opened this issue
- Dominant language
- Java
- Stars
- 524
- Forks
- 300
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from elastic/elasticsearch-java
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
elastic/elasticsearch-java#1339 · 3 comments · 1 assignee ·
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
elastic/elasticsearch-java#1212 · 8 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
elastic/elasticsearch-java#1165 · 5 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
elastic/elasticsearch-java#1083 · 2 comments ·
-
Area: Generator Category: Enhancement
Difficulty 3/5 1-2 days Newbie friendliness 48/100
elastic/elasticsearch-java#1034 · 2 comments ·
All issues in elastic/elasticsearch-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
checkstyle/test-configs#263 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·