88 */
99package org .elasticsearch .action .datastreams ;
1010
11+ import org .elasticsearch .TransportVersion ;
1112import org .elasticsearch .TransportVersions ;
1213import org .elasticsearch .action .ActionRequestValidationException ;
1314import org .elasticsearch .action .ActionResponse ;
@@ -208,6 +209,10 @@ public enum ManagedBy {
208209
209210 public static final ParseField DATA_STREAMS_FIELD = new ParseField ("data_streams" );
210211
212+ private static final TransportVersion INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM = TransportVersion .fromName (
213+ "include_index_mode_in_get_data_stream"
214+ );
215+
211216 public static class DataStreamInfo implements SimpleDiffable <DataStreamInfo >, ToXContentObject {
212217
213218 public static final ParseField STATUS_FIELD = new ParseField ("status" );
@@ -293,9 +298,7 @@ public DataStreamInfo(
293298 : Map .of ();
294299 this .templatePreferIlmValue = in .getTransportVersion ().onOrAfter (V_8_11_X ) ? in .readBoolean () : true ;
295300 this .maximumTimestamp = in .getTransportVersion ().onOrAfter (TransportVersions .V_8_16_0 ) ? in .readOptionalVLong () : null ;
296- this .indexMode = in .getTransportVersion ().onOrAfter (TransportVersions .INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM_BACKPORT_8_19 )
297- ? in .readOptionalString ()
298- : null ;
301+ this .indexMode = in .getTransportVersion ().supports (INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM ) ? in .readOptionalString () : null ;
299302 }
300303
301304 public DataStream getDataStream () {
@@ -362,7 +365,7 @@ public void writeTo(StreamOutput out) throws IOException {
362365 if (out .getTransportVersion ().onOrAfter (TransportVersions .V_8_16_0 )) {
363366 out .writeOptionalVLong (maximumTimestamp );
364367 }
365- if (out .getTransportVersion ().onOrAfter ( TransportVersions . INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM_BACKPORT_8_19 )) {
368+ if (out .getTransportVersion ().supports ( INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM )) {
366369 out .writeOptionalString (indexMode );
367370 }
368371 }
@@ -600,9 +603,7 @@ public IndexProperties(StreamInput in) throws IOException {
600603 in .readBoolean (),
601604 in .readOptionalString (),
602605 in .readEnum (ManagedBy .class ),
603- in .getTransportVersion ().onOrAfter (TransportVersions .INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM_BACKPORT_8_19 )
604- ? in .readOptionalString ()
605- : "unknown"
606+ in .getTransportVersion ().supports (INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM ) ? in .readOptionalString () : "unknown"
606607 );
607608 }
608609
@@ -611,7 +612,7 @@ public void writeTo(StreamOutput out) throws IOException {
611612 out .writeBoolean (preferIlm );
612613 out .writeOptionalString (ilmPolicyName );
613614 out .writeEnum (managedBy );
614- if (out .getTransportVersion ().onOrAfter ( TransportVersions . INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM_BACKPORT_8_19 )) {
615+ if (out .getTransportVersion ().supports ( INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM )) {
615616 out .writeOptionalString (indexMode );
616617 }
617618 }
0 commit comments