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 ;
@@ -209,6 +210,10 @@ public enum ManagedBy {
209
210
210
211
public static final ParseField DATA_STREAMS_FIELD = new ParseField ("data_streams" );
211
212
213
+ private static final TransportVersion INCLUDE_INDEX_MODE_IN_GET_DATA_STREAM = TransportVersion .fromName (
214
+ "include_index_mode_in_get_data_stream"
215
+ );
216
+
212
217
public static class DataStreamInfo implements SimpleDiffable <DataStreamInfo >, ToXContentObject {
213
218
214
219
public static final ParseField STATUS_FIELD = new ParseField ("status" );
@@ -345,7 +350,7 @@ public void writeTo(StreamOutput out) throws IOException {
345
350
if (out .getTransportVersion ().onOrAfter (TransportVersions .V_8_16_0 )) {
346
351
out .writeOptionalVLong (maximumTimestamp );
347
352
}
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 )) {
349
354
out .writeOptionalString (indexMode );
350
355
}
351
356
}
@@ -583,9 +588,7 @@ public IndexProperties(StreamInput in) throws IOException {
583
588
in .readBoolean (),
584
589
in .readOptionalString (),
585
590
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"
589
592
);
590
593
}
591
594
@@ -594,7 +597,7 @@ public void writeTo(StreamOutput out) throws IOException {
594
597
out .writeBoolean (preferIlm );
595
598
out .writeOptionalString (ilmPolicyName );
596
599
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 )) {
598
601
out .writeOptionalString (indexMode );
599
602
}
600
603
}
0 commit comments