Skip to content

Commit 5ab7032

Browse files
committed
Fix rewrite
1 parent caf5f05 commit 5ab7032

File tree

2 files changed

+4
-2
lines changed
  • x-pack/plugin/esql

2 files changed

+4
-2
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/LuceneSliceQueue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public static LuceneSliceQueue create(
7979
Map<String, PartitioningStrategy> partitioningStrategies = new HashMap<>(contexts.size());
8080
for (ShardContext ctx : contexts) {
8181
Query query = queryFunction.apply(ctx);
82+
query = scoreMode.needsScores() ? query : new ConstantScoreQuery(query);
8283
/*
8384
* Rewrite the query on the local index so things like fully
8485
* overlapping range queries become match all. It's important
@@ -87,7 +88,7 @@ public static LuceneSliceQueue create(
8788
* into MatchAll.
8889
*/
8990
try {
90-
query = query.rewrite(ctx.searcher());
91+
query = ctx.searcher().rewrite(query);
9192
} catch (IOException e) {
9293
throw new UncheckedIOException(e);
9394
}

x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/RestEsqlIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,8 @@ private String checkOperatorProfile(Map<String, Object> o) {
687687
.entry("pages_emitted", greaterThan(0))
688688
.entry("rows_emitted", greaterThan(0))
689689
.entry("process_nanos", greaterThan(0))
690-
.entry("processed_queries", List.of("*:*"));
690+
.entry("processed_queries", List.of("*:*"))
691+
.entry("partitioning_strategies", matchesMap().entry("rest-esql-test:0", "SHARD"));
691692
case "ValuesSourceReaderOperator" -> basicProfile().entry("readers_built", matchesMap().extraOk());
692693
case "AggregationOperator" -> matchesMap().entry("pages_processed", greaterThan(0))
693694
.entry("rows_received", greaterThan(0))

0 commit comments

Comments
 (0)