Java Rest API does not allow ForceMergeAction for hot phase in LifeCyclePolicy

While Elasticsearch REST API allows defining forcemerge action for hot phase, Java Rest API (v7.10.2) does not.

This is allowed:

PUT _ilm/policy/custom-ilm-policy
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "1d"
          },
          "forcemerge": {
            "max_num_segments": 1
          },
          "set_priority": {
            "priority": 200
          }
        }
      },
      "delete": {
        "min_age": "30d",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }
        }
      }
    }
  }
}

This is not allowed:

Map<String, LifecycleAction> hotActions = new HashMap<>();

// Rollover action
hotActions.put(RolloverAction.NAME, new RolloverAction(
        new ByteSizeValue(50, ByteSizeUnit.GB), null, null));

// Forcemerge action
hotActions.put(ForceMergeAction.NAME, new ForceMergeAction(1));

phases.put("hot", new Phase("hot", TimeValue.ZERO, hotActions)); 

IllegalArgumentException is thrown with error invalid action [forcemerge] defined in phase [hot]. See LifeCyclePolicy

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