Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explainLifecycle API unable to deserialise the response: managed value is the boolean type instead of a string. #882

Open
voron86 opened this issue Sep 18, 2024 · 1 comment
Labels
Area: Generator Category: Bug Something isn't working

Comments

@voron86
Copy link

voron86 commented Sep 18, 2024

Java API client version

8.15.1

Java version

Kotlin 2.0

Elasticsearch Version

8.x

Problem description

Response to deserialise:

{"indices":{".ds-projects_34567_streams_elastic-storage-test-b7b32332-0284-418f-bfe5-7e2d2aea59c0-2024.09.18-000001":{"index":".ds-projects_34567_streams_elastic-storage-test-b7b32332-0284-418f-bfe5-7e2d2aea59c0-2024.09.18-000001","managed":true,"policy":"projects_34567_ilm_elastic-storage-test-b7b32332-0284-418f-bfe5-7e2d2aea59c0","index_creation_date_millis":1726660947122,"time_since_index_creation":"2.88s","lifecycle_date_millis":1726660947122,"age":"2.88s","phase":"hot","phase_time_millis":1726660947249,"action":"rollover","action_time_millis":1726660947249,"step":"check-rollover-ready","step_time_millis":1726660947249,"phase_execution":{"policy":"projects_34567_ilm_elastic-storage-test-b7b32332-0284-418f-bfe5-7e2d2aea59c0","phase_definition":{"min_age":"0ms","actions":{"rollover":{"max_primary_shard_docs":200000000,"max_docs":100,"min_docs":1,"max_size":"8192b"}}},"version":1,"modified_date_in_millis":1726660946884}}}}

Error:

Error deserializing co.elastic.clients.elasticsearch.ilm.explain_lifecycle.LifecycleExplain: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'VALUE_TRUE' instead of 'VALUE_STRING'

Caused by: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'VALUE_TRUE' instead of 'VALUE_STRING'

I see there were similar bugs with other API deserialisers.

@l-trotta l-trotta added Area: Generator Category: Bug Something isn't working labels Sep 23, 2024
@l-trotta
Copy link
Contributor

Hello! The boolean value of managed is actually correct, we can check that in the server code. The issue is a bit more complex: we use that field to userstand whether a LifecycleExplain response has to be deserialized into a LifecycleExplainManaged or a LifecycleExplainUnmanaged type response, and the java client defaults to String when dealing with this kind of utility fields, ignoring the original value (in this case boolean). We'll fix the java client generator to handle different value fields which act as disambiguation for different responses. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Generator Category: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants