PutLifecycleRequest with new Java client

Hi,

What is the approach for creating Lifecycle Policy with new Java client.
Policy of rollover after 10gb maxShardSize and delete after 5d.

Thanks...

Try this:

client.ilm().putLifecycle(plr -> plr
        .name("my-ilm")
        .policy(p -> p
                .phases(ph -> ph
                        .hot(h -> h
                                .actions(JsonData.fromJson("{\"rollover\":{\"max_age\":\"5d\",\"max_size\":\"10gb\"}}"))
                        )
                )
        )
);

I was trying this

PutLifecycleRequest request = PutLifecycleRequest.of(plr -> plr
					.name(policyName)
					.policy(p -> p
							.phases(phase -> phase
									.hot(h -> h
											.configurations(c -> c
													.rollover(r -> r
															.maxPrimaryShardSize(10gb)))))
									.delete(d -> d
											.minAge(t -> t
													.time(7d))))));

but it fail because action is missing in delete.
Is action can be added just has a json?

Yes. Apparently it's not fully supported yet. I learned it as well the hard way :wink:
It will be probably in the future...

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.