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

Inconsistent formatting of ILM Phase's min_age in XPack usage API #87327

Open
swallez opened this issue Jun 2, 2022 · 3 comments
Open

Inconsistent formatting of ILM Phase's min_age in XPack usage API #87327

swallez opened this issue Jun 2, 2022 · 3 comments
Labels
>bug :Data Management/ILM+SLM Index and Snapshot lifecycle management Team:Data Management Meta label for data/management team

Comments

@swallez
Copy link
Member

swallez commented Jun 2, 2022

Elasticsearch Version

Since 7.0.0

Installed Plugins

No response

Java Version

bundled

OS Version

all

Problem Description

The format used to serialize ILM policy phases to JSON in GET _xpack/usage is not the same as the one used for GET _ilm/policy. The min_age property is serialized a millisecond value in the former (e.g. 172800000) (code), and as a TimeValue (e.g. "2d") il the latter (code).

Furthermore, the format used in xpack/usage is incompatible with PUT /_ilm/policy/{name} (RestPutLifecycleAction) that expects a TimeValue, meaning one cannot take the JSON output of _xpack/usage and use is to create an ILM policy.

Steps to Reproduce

On an ES with ILM policies, compare the output of GET _xpack/usage and GET _ilm/policy.

Logs (if relevant)

No response

@swallez swallez added >bug :Data Management/ILM+SLM Index and Snapshot lifecycle management needs:triage Requires assignment of a team area label labels Jun 2, 2022
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Jun 2, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@dakrone
Copy link
Member

dakrone commented Jun 20, 2022

This is because the XPack telemetry is intended to be machine-readable and indexed into a numeric field. The GET-policy output is human-readable (and in the format the user provides).

the format used in xpack/usage is incompatible with PUT /_ilm/policy/{name} ..., meaning one cannot take the JSON output of _xpack/usage and use is to create an ILM policy.

These APIs are not intended to be counterparts to each other, they have different functions. Can you share some more information about why you want to take the output of a telemetry/usage API and feed it into the create policy API?

@swallez
Copy link
Member Author

swallez commented Jun 24, 2022

Can you share some more information about why you want to take the output of a telemetry/usage API and feed it into the create policy API?

There is no formally identified use case, we found this issue while testing the ILM and XPack API specifications that use the same data structure for ILM phases. The @esquirk annotation there indicates an inconsistency that client libraries code generators have to take special care of, as durations are generally expressed as a string with an associated xxx_as_millis number property.

We could also avoid the @esquik by creating two separate data structures, but that doesn't feel right as they really are the same, except for this property's format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/ILM+SLM Index and Snapshot lifecycle management Team:Data Management Meta label for data/management team
Projects
None yet
Development

No branches or pull requests

4 participants