From c31fc58f062e38a9baf3eae8c51d6bd15f3b8504 Mon Sep 17 00:00:00 2001 From: Aurelien FOUCRET Date: Tue, 12 Dec 2023 18:59:26 +0100 Subject: [PATCH] Fix CI tests. --- .../main/java/org/elasticsearch/xpack/ml/MachineLearning.java | 2 +- .../java/org/elasticsearch/xpack/ml/MachineLearningTests.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java index 931a733dc448b..bf84801a05481 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java @@ -889,7 +889,7 @@ private static void reportClashingNodeAttribute(String attrName) { @Override public List> getRescorers() { - if (enabled && machineLearningExtension.get().isLearningToRankEnabled()) { + if (enabled && machineLearningExtension.get() != null && machineLearningExtension.get().isLearningToRankEnabled()) { return List.of( new RescorerSpec<>( LearningToRankRescorerBuilder.NAME, diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTests.java index ef7eaf452f0fc..ae9a503d3734c 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTests.java @@ -385,8 +385,6 @@ protected XPackLicenseState getLicenseState() { } public static MachineLearning createTrialLicensedMachineLearning(Settings settings) { - MachineLearning plugin = new TrialLicensedMachineLearning(settings); - plugin.loadExtensions(null); - return plugin; + return new TrialLicensedMachineLearning(settings); } }