Migrating HLRC IndexLifecycleClient to ES:8.8.1

I'm in the process of migrating from Elasticsearch version 7.17.0 to version 8.8.1. In my existing code, I'm using the High-Level Rest Client (HLRC) to manage Index Lifecycle Policies. However, in Elasticsearch version 8.8.1, it seems that the IndexLifecycleClient has been removed, and I'm unable to find an alternate method to perform the same functionality.

Specifically, I was using the PutLifecyclePolicyRequest to create a new policy. In Elasticsearch 8.8.1, it seems this is now named PutLifecycleRequest. Can anyone confirm if this performs the same functionality?

Additionally, any guidance or examples on how to implement Index Lifecycle Management using the ElasticsearchClient in version 8.8.1 would be greatly appreciated. Thank you.

HLRC code:

private void createLifecyclePolicy(RestHighLevelClient client) throws IOException {
    try {
      IndexLifecycleClient lsClient = client.indexLifecycle();
      Map<String, Phase> phases = new HashMap<>();
      Map<String, LifecycleAction> hotActions = new HashMap<>();
          new RolloverAction(new ByteSizeValue(25, ByteSizeUnit.GB), null, null, null));
      phases.put("hot", new Phase("hot", TimeValue.ZERO, hotActions));
      LifecyclePolicy lifecyclePolicy =
          new LifecyclePolicy(elasticsearchPropertyProvider.getBulkFilterPolicyName(), phases);
      AcknowledgedResponse response =
              new PutLifecyclePolicyRequest(lifecyclePolicy), RequestOptions.DEFAULT);
      logger.info("Create policy acknowledgement : {}", response.isAcknowledged());
    } catch (Exception e) {
      logger.error(e, "Error while creating lifecycle policy");
      throw e;
private boolean isLifecyclePolicyExists(RestHighLevelClient client) throws IOException {
      GetLifecyclePolicyResponse lifecyclePolicy =
                  new GetLifecyclePolicyRequest(
      logger.info("Policy found : {}", lifecyclePolicy.getPolicies());
      return true;

Tried with methods PutLifecycleRequest, GetLifecycleRequest, IlmPolicy. Unable to implement the same functionality using new methods of ES-8.8.1 and need more examples.

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