8
8
*/
9
9
package org .elasticsearch .action .datastreams ;
10
10
11
+ import org .elasticsearch .TransportVersion ;
11
12
import org .elasticsearch .TransportVersions ;
12
13
import org .elasticsearch .action .ActionRequestValidationException ;
13
14
import org .elasticsearch .action .ActionResponse ;
@@ -208,6 +209,10 @@ public enum ManagedBy {
208
209
209
210
public static final ParseField DATA_STREAMS_FIELD = new ParseField ("data_streams" );
210
211
212
+ private static final TransportVersion INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM = TransportVersion .fromName (
213
+ "include_index_mode_in_get_data_stream"
214
+ );
215
+
211
216
public static class DataStreamInfo implements SimpleDiffable <DataStreamInfo >, ToXContentObject {
212
217
213
218
public static final ParseField STATUS_FIELD = new ParseField ("status" );
@@ -293,9 +298,7 @@ public DataStreamInfo(
293
298
: Map .of ();
294
299
this .templatePreferIlmValue = in .getTransportVersion ().onOrAfter (V_8_11_X ) ? in .readBoolean () : true ;
295
300
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 ;
299
302
}
300
303
301
304
public DataStream getDataStream () {
@@ -362,7 +365,7 @@ public void writeTo(StreamOutput out) throws IOException {
362
365
if (out .getTransportVersion ().onOrAfter (TransportVersions .V_8_16_0 )) {
363
366
out .writeOptionalVLong (maximumTimestamp );
364
367
}
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 )) {
366
369
out .writeOptionalString (indexMode );
367
370
}
368
371
}
@@ -600,9 +603,7 @@ public IndexProperties(StreamInput in) throws IOException {
600
603
in .readBoolean (),
601
604
in .readOptionalString (),
602
605
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"
606
607
);
607
608
}
608
609
@@ -611,7 +612,7 @@ public void writeTo(StreamOutput out) throws IOException {
611
612
out .writeBoolean (preferIlm );
612
613
out .writeOptionalString (ilmPolicyName );
613
614
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 )) {
615
616
out .writeOptionalString (indexMode );
616
617
}
617
618
}
0 commit comments