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 ;
@@ -209,6 +210,10 @@ public enum ManagedBy {
209210
210211 public static final ParseField DATA_STREAMS_FIELD = new ParseField ("data_streams" );
211212
213+ private static final TransportVersion INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM = TransportVersion .fromName (
214+ "include_index_mode_in_get_data_stream"
215+ );
216+
212217 public static class DataStreamInfo implements SimpleDiffable <DataStreamInfo >, ToXContentObject {
213218
214219 public static final ParseField STATUS_FIELD = new ParseField ("status" );
@@ -345,7 +350,7 @@ public void writeTo(StreamOutput out) throws IOException {
345350 if (out .getTransportVersion ().onOrAfter (TransportVersions .V_8_16_0 )) {
346351 out .writeOptionalVLong (maximumTimestamp );
347352 }
348- if (out .getTransportVersion ().onOrAfter ( TransportVersions . INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM )) {
353+ if (out .getTransportVersion ().supports ( INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM )) {
349354 out .writeOptionalString (indexMode );
350355 }
351356 }
@@ -583,9 +588,7 @@ public IndexProperties(StreamInput in) throws IOException {
583588 in .readBoolean (),
584589 in .readOptionalString (),
585590 in .readEnum (ManagedBy .class ),
586- in .getTransportVersion ().onOrAfter (TransportVersions .INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM )
587- ? in .readOptionalString ()
588- : "unknown"
591+ in .getTransportVersion ().supports (INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM ) ? in .readOptionalString () : "unknown"
589592 );
590593 }
591594
@@ -594,7 +597,7 @@ public void writeTo(StreamOutput out) throws IOException {
594597 out .writeBoolean (preferIlm );
595598 out .writeOptionalString (ilmPolicyName );
596599 out .writeEnum (managedBy );
597- if (out .getTransportVersion ().onOrAfter ( TransportVersions . INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM )) {
600+ if (out .getTransportVersion ().supports ( INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM )) {
598601 out .writeOptionalString (indexMode );
599602 }
600603 }
0 commit comments