Skip to content

Commit 515583b

Browse files
[ML] Require 7.12 as min version for using runtime fields in DFA (#69590)
As we make use of the field caps API `runtime_mappings` feature we should prevent data frame analytics jobs from being created in a cluster that contains nodes prior to 7.12. Relates #69331
1 parent 01f187b commit 515583b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportPutDataFrameAnalyticsAction.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ public class TransportPutDataFrameAnalyticsAction
6464

6565
private static final Logger logger = LogManager.getLogger(TransportPutDataFrameAnalyticsAction.class);
6666

67+
private static final Version MIN_VERSION_FOR_RUNTIME_FIELDS = Version.V_7_12_0;
68+
6769
private final XPackLicenseState licenseState;
6870
private final DataFrameAnalyticsConfigProvider configProvider;
6971
private final SecurityContext securityContext;
@@ -119,13 +121,14 @@ protected void masterOperation(PutDataFrameAnalyticsAction.Request request, Clus
119121

120122
// Check if runtime mappings are used but the cluster contains nodes on a version
121123
// before runtime fields were introduced and reject such configs.
122-
if (config.getSource().getRuntimeMappings().isEmpty() == false && state.nodes().getMinNodeVersion().before(Version.V_7_11_0)) {
124+
if (config.getSource().getRuntimeMappings().isEmpty() == false
125+
&& state.nodes().getMinNodeVersion().before(MIN_VERSION_FOR_RUNTIME_FIELDS)) {
123126
listener.onFailure(ExceptionsHelper.badRequestException(
124127
"at least one cluster node is on a version [{}] that does not support [{}]; " +
125128
"all nodes should be at least on version [{}] in order to create data frame analytics with [{}]",
126129
state.nodes().getMinNodeVersion(),
127130
SearchSourceBuilder.RUNTIME_MAPPINGS_FIELD.getPreferredName(),
128-
Version.V_7_11_0,
131+
MIN_VERSION_FOR_RUNTIME_FIELDS,
129132
SearchSourceBuilder.RUNTIME_MAPPINGS_FIELD.getPreferredName()
130133
)
131134
);

0 commit comments

Comments
 (0)