Description
openedon Dec 8, 2022
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