Skip to content

Commit 1a5ce0f

Browse files
afoucretdakrone
authored andcommitted
Removing the feature flag mechanism for LTR. (elastic#112358)
1 parent 501e611 commit 1a5ce0f

File tree

8 files changed

+13
-41
lines changed

8 files changed

+13
-41
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ public boolean isNlpEnabled() {
5151
return true;
5252
}
5353

54-
@Override
55-
public boolean isLearningToRankEnabled() {
56-
return true;
57-
}
58-
5954
@Override
6055
public String[] getAnalyticsDestIndexAllowedSettings() {
6156
return ANALYTICS_DEST_INDEX_ALLOWED_SETTINGS;

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ private static void reportClashingNodeAttribute(String attrName) {
902902

903903
@Override
904904
public List<RescorerSpec<?>> getRescorers() {
905-
if (enabled && machineLearningExtension.get().isLearningToRankEnabled()) {
905+
if (enabled) {
906906
return List.of(
907907
new RescorerSpec<>(
908908
LearningToRankRescorerBuilder.NAME,
@@ -1864,10 +1864,8 @@ public List<NamedXContentRegistry.Entry> getNamedXContent() {
18641864
)
18651865
);
18661866
namedXContent.addAll(new CorrelationNamedContentProvider().getNamedXContentParsers());
1867-
// LTR Combine with Inference named content provider when feature flag is removed
1868-
if (machineLearningExtension.get().isLearningToRankEnabled()) {
1869-
namedXContent.addAll(new MlLTRNamedXContentProvider().getNamedXContentParsers());
1870-
}
1867+
namedXContent.addAll(new MlLTRNamedXContentProvider().getNamedXContentParsers());
1868+
18711869
return namedXContent;
18721870
}
18731871

@@ -1958,10 +1956,8 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
19581956
namedWriteables.addAll(MlAutoscalingNamedWritableProvider.getNamedWriteables());
19591957
namedWriteables.addAll(new CorrelationNamedContentProvider().getNamedWriteables());
19601958
namedWriteables.addAll(new ChangePointNamedContentProvider().getNamedWriteables());
1961-
// LTR Combine with Inference named content provider when feature flag is removed
1962-
if (machineLearningExtension.get().isLearningToRankEnabled()) {
1963-
namedWriteables.addAll(new MlLTRNamedXContentProvider().getNamedWriteables());
1964-
}
1959+
namedWriteables.addAll(new MlLTRNamedXContentProvider().getNamedWriteables());
1960+
19651961
return namedWriteables;
19661962
}
19671963

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ default void configure(Settings settings) {}
2525

2626
boolean isNlpEnabled();
2727

28-
default boolean isLearningToRankEnabled() {
29-
return true;
30-
}
31-
3228
default boolean disableInferenceProcessCache() {
3329
return false;
3430
}

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/LocalStateMachineLearningAdOnly.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
public class LocalStateMachineLearningAdOnly extends LocalStateMachineLearning {
1616
public LocalStateMachineLearningAdOnly(final Settings settings, final Path configPath) {
17-
super(settings, configPath, new MlTestExtensionLoader(new MlTestExtension(true, true, true, false, false, false)));
17+
super(settings, configPath, new MlTestExtensionLoader(new MlTestExtension(true, true, true, false, false)));
1818
}
1919
}

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/LocalStateMachineLearningDfaOnly.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
public class LocalStateMachineLearningDfaOnly extends LocalStateMachineLearning {
1616
public LocalStateMachineLearningDfaOnly(final Settings settings, final Path configPath) {
17-
super(settings, configPath, new MlTestExtensionLoader(new MlTestExtension(true, true, false, true, false, false)));
17+
super(settings, configPath, new MlTestExtensionLoader(new MlTestExtension(true, true, false, true, false)));
1818
}
1919
}

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/LocalStateMachineLearningNlpOnly.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
public class LocalStateMachineLearningNlpOnly extends LocalStateMachineLearning {
1616
public LocalStateMachineLearningNlpOnly(final Settings settings, final Path configPath) {
17-
super(settings, configPath, new MlTestExtensionLoader(new MlTestExtension(true, true, false, false, true, false)));
17+
super(settings, configPath, new MlTestExtensionLoader(new MlTestExtension(true, true, false, false, true)));
1818
}
1919
}

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MachineLearningInfoTransportActionTests.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,7 @@ private MachineLearningUsageTransportAction newUsageAction(
160160
licenseState,
161161
jobManagerHolder,
162162
new MachineLearningExtensionHolder(
163-
new MachineLearningTests.MlTestExtension(
164-
true,
165-
true,
166-
isAnomalyDetectionEnabled,
167-
isDataFrameAnalyticsEnabled,
168-
isNlpEnabled,
169-
true
170-
)
163+
new MachineLearningTests.MlTestExtension(true, true, isAnomalyDetectionEnabled, isDataFrameAnalyticsEnabled, isNlpEnabled)
171164
)
172165
);
173166
}

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTests.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public void testNoAttributes_givenClash() throws IOException {
220220

221221
public void testAnomalyDetectionOnly() throws IOException {
222222
Settings settings = Settings.builder().put("path.home", createTempDir()).build();
223-
MlTestExtensionLoader loader = new MlTestExtensionLoader(new MlTestExtension(false, false, true, false, false, false));
223+
MlTestExtensionLoader loader = new MlTestExtensionLoader(new MlTestExtension(false, false, true, false, false));
224224
try (MachineLearning machineLearning = createTrialLicensedMachineLearning(settings, loader)) {
225225
List<RestHandler> restHandlers = machineLearning.getRestHandlers(settings, null, null, null, null, null, null, null, null);
226226
assertThat(restHandlers, hasItem(instanceOf(RestMlInfoAction.class)));
@@ -240,7 +240,7 @@ public void testAnomalyDetectionOnly() throws IOException {
240240

241241
public void testDataFrameAnalyticsOnly() throws IOException {
242242
Settings settings = Settings.builder().put("path.home", createTempDir()).build();
243-
MlTestExtensionLoader loader = new MlTestExtensionLoader(new MlTestExtension(false, false, false, true, false, false));
243+
MlTestExtensionLoader loader = new MlTestExtensionLoader(new MlTestExtension(false, false, false, true, false));
244244
try (MachineLearning machineLearning = createTrialLicensedMachineLearning(settings, loader)) {
245245
List<RestHandler> restHandlers = machineLearning.getRestHandlers(settings, null, null, null, null, null, null, null, null);
246246
assertThat(restHandlers, hasItem(instanceOf(RestMlInfoAction.class)));
@@ -260,7 +260,7 @@ public void testDataFrameAnalyticsOnly() throws IOException {
260260

261261
public void testNlpOnly() throws IOException {
262262
Settings settings = Settings.builder().put("path.home", createTempDir()).build();
263-
MlTestExtensionLoader loader = new MlTestExtensionLoader(new MlTestExtension(false, false, false, false, true, false));
263+
MlTestExtensionLoader loader = new MlTestExtensionLoader(new MlTestExtension(false, false, false, false, true));
264264
try (MachineLearning machineLearning = createTrialLicensedMachineLearning(settings, loader)) {
265265
List<RestHandler> restHandlers = machineLearning.getRestHandlers(settings, null, null, null, null, null, null, null, null);
266266
assertThat(restHandlers, hasItem(instanceOf(RestMlInfoAction.class)));
@@ -287,22 +287,19 @@ public static class MlTestExtension implements MachineLearningExtension {
287287
private final boolean isAnomalyDetectionEnabled;
288288
private final boolean isDataFrameAnalyticsEnabled;
289289
private final boolean isNlpEnabled;
290-
private final boolean isLearningToRankEnabled;
291290

292291
MlTestExtension(
293292
boolean useIlm,
294293
boolean includeNodeInfo,
295294
boolean isAnomalyDetectionEnabled,
296295
boolean isDataFrameAnalyticsEnabled,
297-
boolean isNlpEnabled,
298-
boolean isLearningToRankEnabled
296+
boolean isNlpEnabled
299297
) {
300298
this.useIlm = useIlm;
301299
this.includeNodeInfo = includeNodeInfo;
302300
this.isAnomalyDetectionEnabled = isAnomalyDetectionEnabled;
303301
this.isDataFrameAnalyticsEnabled = isDataFrameAnalyticsEnabled;
304302
this.isNlpEnabled = isNlpEnabled;
305-
this.isLearningToRankEnabled = isLearningToRankEnabled;
306303
}
307304

308305
@Override
@@ -330,11 +327,6 @@ public boolean isNlpEnabled() {
330327
return isNlpEnabled;
331328
}
332329

333-
@Override
334-
public boolean isLearningToRankEnabled() {
335-
return isLearningToRankEnabled;
336-
}
337-
338330
@Override
339331
public String[] getAnalyticsDestIndexAllowedSettings() {
340332
return ANALYTICS_DEST_INDEX_ALLOWED_SETTINGS;

0 commit comments

Comments
 (0)