Skip to content

ILM Documentation missing/ lifecyle policy error #464

Open

Description

Am converting an elastic 7.x to elastic 8.x. Mostly working, but I must be translating this ILM put incorrectly. I see nice documentation for the elastic 7.17 Rest client
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-ilm-ilm-put-lifecycle-policy.html
but such a nice example or java based documentation eludes me with the Java API.
What I've come up with hacking around is:
ElasticsearchClient elasticsearchClient = new ElasticsearchClient(transport); Time sevenDays = Time.of(t -> t.time("7d")); PutLifecycleResponse response = elasticsearchClient.ilm() .putLifecycle(putLifecycleBuilder -> putLifecycleBuilder.name(DeleteAction.NAME) .policy(policy -> policy.phases(phaseBuilder -> phaseBuilder.delete(phase -> phase.minAge(sevenDays)))));
but this fails with:
[es/ilm.put_lifecycle] failed: [x_content_parse_exception] [1:46] [put_lifecycle_request] failed to parse field [policy]
Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Area: DocumentationImprovements or additions to documentationCategory: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions