diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperator.java index e8dd245355687..83d69393a45a2 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperator.java +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperator.java @@ -43,8 +43,8 @@ import java.util.function.Function; import java.util.stream.Collectors; -import static org.apache.lucene.search.ScoreMode.COMPLETE; import static org.apache.lucene.search.ScoreMode.TOP_DOCS; +import static org.apache.lucene.search.ScoreMode.TOP_DOCS_WITH_SCORES; /** * Source operator that builds Pages out of the output of a TopFieldCollector (aka TopN) @@ -65,7 +65,7 @@ public Factory( List> sorts, boolean scoring ) { - super(contexts, queryFunction, dataPartitioning, taskConcurrency, limit, scoring ? COMPLETE : TOP_DOCS); + super(contexts, queryFunction, dataPartitioning, taskConcurrency, limit, scoring ? TOP_DOCS_WITH_SCORES : TOP_DOCS); this.maxPageSize = maxPageSize; this.sorts = sorts; } @@ -287,7 +287,7 @@ PerShardCollector newPerShardCollector(ShardContext shardContext, List buildSort(List> sorts) { @Override protected Matcher expectedToStringOfSimple() { return matchesRegex( - "LuceneTopNSourceOperator\\[shards = \\[test], maxPageSize = \\d+, limit = 100, scoreMode = COMPLETE, sorts = \\[\\{.+}]]" + "LuceneTopNSourceOperator\\[shards = \\[test], " + + "maxPageSize = \\d+, limit = 100, scoreMode = TOP_DOCS_WITH_SCORES, sorts = \\[\\{.+}]]" ); } @Override protected Matcher expectedDescriptionOfSimple() { return matchesRegex( - "LuceneTopNSourceOperator" - + "\\[dataPartitioning = (DOC|SHARD|SEGMENT), maxPageSize = \\d+, limit = 100, scoreMode = COMPLETE, sorts = \\[\\{.+}]]" + "LuceneTopNSourceOperator\\[dataPartitioning = (DOC|SHARD|SEGMENT), " + + "maxPageSize = \\d+, limit = 100, scoreMode = TOP_DOCS_WITH_SCORES, sorts = \\[\\{.+}]]" ); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java index 95d5cbc65d756..9210cfda65c04 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java @@ -114,7 +114,7 @@ public Optional buildSort(List> sorts) { @Override protected Matcher expectedToStringOfSimple() { - var s = scoring ? "COMPLETE" : "TOP_DOCS"; + var s = scoring ? "TOP_DOCS_WITH_SCORES" : "TOP_DOCS"; return matchesRegex( "LuceneTopNSourceOperator\\[shards = \\[test], maxPageSize = \\d+, limit = 100, scoreMode = " + s + ", sorts = \\[\\{.+}]]" ); @@ -122,7 +122,7 @@ protected Matcher expectedToStringOfSimple() { @Override protected Matcher expectedDescriptionOfSimple() { - var s = scoring ? "COMPLETE" : "TOP_DOCS"; + var s = scoring ? "TOP_DOCS_WITH_SCORES" : "TOP_DOCS"; return matchesRegex( "LuceneTopNSourceOperator" + "\\[dataPartitioning = (DOC|SHARD|SEGMENT), maxPageSize = \\d+, limit = 100, scoreMode = "