@@ -57,6 +57,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
5757 private static final ParseField SHRINK_INDEX_NAME = new ParseField ("shrink_index_name" );
5858 private static final ParseField SNAPSHOT_NAME = new ParseField ("snapshot_name" );
5959 private static final ParseField SKIP_NAME = new ParseField ("skip" );
60+ private static final ParseField FORCE_MERGE_INDEX_NAME = new ParseField ("force_merge_index_name" );
6061
6162 public static final ConstructingObjectParser <IndexLifecycleExplainResponse , Void > PARSER = new ConstructingObjectParser <>(
6263 "index_lifecycle_explain_response" ,
@@ -81,7 +82,8 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
8182 (BytesReference ) a [11 ],
8283 (BytesReference ) a [21 ],
8384 (PhaseExecutionInfo ) a [12 ],
84- Objects .requireNonNullElse ((Boolean ) a [22 ], false )
85+ Objects .requireNonNullElse ((Boolean ) a [22 ], false ),
86+ (String ) a [24 ]
8587 // a[13] == "age"
8688 // a[20] == "time_since_index_creation"
8789 // a[23] = "age_in_millis"
@@ -124,6 +126,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
124126 }, PREVIOUS_STEP_INFO_FIELD );
125127 PARSER .declareBoolean (ConstructingObjectParser .optionalConstructorArg (), SKIP_NAME );
126128 PARSER .declareLong (ConstructingObjectParser .optionalConstructorArg (), AGE_IN_MILLIS_FIELD );
129+ PARSER .declareString (ConstructingObjectParser .optionalConstructorArg (), FORCE_MERGE_INDEX_NAME );
127130 }
128131
129132 private final String index ;
@@ -147,6 +150,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
147150 private final String snapshotName ;
148151 private final String shrinkIndexName ;
149152 private final boolean skip ;
153+ private final String forceMergeIndexName ;
150154
151155 Supplier <Long > nowSupplier = System ::currentTimeMillis ; // Can be changed for testing
152156
@@ -170,7 +174,8 @@ public static IndexLifecycleExplainResponse newManagedIndexResponse(
170174 BytesReference stepInfo ,
171175 BytesReference previousStepInfo ,
172176 PhaseExecutionInfo phaseExecutionInfo ,
173- boolean skip
177+ boolean skip ,
178+ String forceMergeIndexName
174179 ) {
175180 return new IndexLifecycleExplainResponse (
176181 index ,
@@ -193,7 +198,8 @@ public static IndexLifecycleExplainResponse newManagedIndexResponse(
193198 stepInfo ,
194199 previousStepInfo ,
195200 phaseExecutionInfo ,
196- skip
201+ skip ,
202+ forceMergeIndexName
197203 );
198204 }
199205
@@ -219,7 +225,8 @@ public static IndexLifecycleExplainResponse newUnmanagedIndexResponse(String ind
219225 null ,
220226 null ,
221227 null ,
222- false
228+ false ,
229+ null
223230 );
224231 }
225232
@@ -244,7 +251,8 @@ private IndexLifecycleExplainResponse(
244251 BytesReference stepInfo ,
245252 BytesReference previousStepInfo ,
246253 PhaseExecutionInfo phaseExecutionInfo ,
247- boolean skip
254+ boolean skip ,
255+ String forceMergeIndexName
248256 ) {
249257 if (managedByILM ) {
250258 if (policyName == null ) {
@@ -313,6 +321,7 @@ private IndexLifecycleExplainResponse(
313321 this .snapshotName = snapshotName ;
314322 this .shrinkIndexName = shrinkIndexName ;
315323 this .skip = skip ;
324+ this .forceMergeIndexName = forceMergeIndexName ;
316325 }
317326
318327 public IndexLifecycleExplainResponse (StreamInput in ) throws IOException {
@@ -351,6 +360,8 @@ public IndexLifecycleExplainResponse(StreamInput in) throws IOException {
351360 } else {
352361 skip = false ;
353362 }
363+ // No need for serialization from this point onwards as this action only runs on the local node.
364+ forceMergeIndexName = null ;
354365 } else {
355366 policyName = null ;
356367 lifecycleDate = null ;
@@ -371,6 +382,7 @@ public IndexLifecycleExplainResponse(StreamInput in) throws IOException {
371382 shrinkIndexName = null ;
372383 indexCreationDate = null ;
373384 skip = false ;
385+ forceMergeIndexName = null ;
374386 }
375387 }
376388
@@ -405,6 +417,7 @@ public void writeTo(StreamOutput out) throws IOException {
405417 || out .getTransportVersion ().onOrAfter (TransportVersions .ILM_ADD_SKIP_SETTING )) {
406418 out .writeBoolean (skip );
407419 }
420+ // No need for deserialization from this point onwards as this action only runs on the local node.
408421 }
409422 }
410423
@@ -508,6 +521,10 @@ public boolean getSkip() {
508521 return skip ;
509522 }
510523
524+ public String getForceMergeIndexName () {
525+ return forceMergeIndexName ;
526+ }
527+
511528 @ Override
512529 public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
513530 builder .startObject ();
@@ -595,6 +612,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
595612 builder .field (PHASE_EXECUTION_INFO .getPreferredName (), phaseExecutionInfo );
596613 }
597614 builder .field (SKIP_NAME .getPreferredName (), skip );
615+ if (forceMergeIndexName != null ) {
616+ builder .field (FORCE_MERGE_INDEX_NAME .getPreferredName (), forceMergeIndexName );
617+ }
598618 }
599619 builder .endObject ();
600620 return builder ;
@@ -623,7 +643,8 @@ public int hashCode() {
623643 stepInfo ,
624644 previousStepInfo ,
625645 phaseExecutionInfo ,
626- skip
646+ skip ,
647+ forceMergeIndexName
627648 );
628649 }
629650
@@ -656,7 +677,8 @@ public boolean equals(Object obj) {
656677 && Objects .equals (stepInfo , other .stepInfo )
657678 && Objects .equals (previousStepInfo , other .previousStepInfo )
658679 && Objects .equals (phaseExecutionInfo , other .phaseExecutionInfo )
659- && Objects .equals (skip , other .skip );
680+ && Objects .equals (skip , other .skip )
681+ && Objects .equals (forceMergeIndexName , other .forceMergeIndexName );
660682 }
661683
662684 @ Override
0 commit comments