diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/scheduler/SchedulerConfig.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/scheduler/SchedulerConfig.java index a56be204551..94b4c4cf2b4 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/scheduler/SchedulerConfig.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/scheduler/SchedulerConfig.java @@ -39,6 +39,7 @@ import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.function.Function; /** * Scheduler configuration options. Describes where to proactively pull input @@ -98,7 +99,7 @@ public class SchedulerConfig extends ToXContentToBytes implements Writeable { while (p.nextToken() != XContentParser.Token.END_OBJECT) { parsedScriptFields.add(new SearchSourceBuilder.ScriptField(new QueryParseContext(p, ParseFieldMatcher.STRICT))); } - Collections.sort(parsedScriptFields, Comparator.comparing(f -> f.fieldName())); + Collections.sort(parsedScriptFields, Comparator.comparing((Function) f -> f.fieldName())); return parsedScriptFields; }, SCRIPT_FIELDS); PARSER.declareInt(Builder::setScrollSize, SCROLL_SIZE); @@ -431,7 +432,7 @@ public class SchedulerConfig extends ToXContentToBytes implements Writeable { public void setScriptFields(List scriptFields) { List sorted = new ArrayList<>(scriptFields); - Collections.sort(sorted, Comparator.comparing(f -> f.fieldName())); + Collections.sort(sorted, Comparator.comparing((Function) f -> f.fieldName())); this.scriptFields = sorted; }