Skip to content

Commit bae7007

Browse files
Add handling for remote not supporting LOOKUP JOIN on multiple fields
1 parent ea171b1 commit bae7007

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/lookup/LookupEnrichQueryGenerator.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
import org.apache.lucene.search.Query;
1111
import org.elasticsearch.core.Nullable;
1212

13+
/**
14+
* An interface to generates queries for the lookup and enrich operators.
15+
* This interface is used to retrieve queries based on a position index.
16+
*/
1317
public interface LookupEnrichQueryGenerator {
1418

1519
/**
@@ -18,6 +22,9 @@ public interface LookupEnrichQueryGenerator {
1822
@Nullable
1923
Query getQuery(int position);
2024

25+
/**
26+
* Returns the number of queries in this generator
27+
*/
2128
int getPositionCount();
2229

2330
}

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/lookup/QueryList.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ protected QueryList(
7474
/**
7575
* Returns the number of positions in this query list
7676
*/
77+
@Override
7778
public int getPositionCount() {
7879
return block.getPositionCount();
7980
}
@@ -87,6 +88,7 @@ public int getPositionCount() {
8788
*/
8889
public abstract QueryList onlySingleValues(Warnings warnings, String multiValueWarningMessage);
8990

91+
@Override
9092
public final Query getQuery(int position) {
9193
final int valueCount = block.getValueCount(position);
9294
if (onlySingleValueParams != null && valueCount != 1) {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ public void writeTo(StreamOutput out) throws IOException {
251251
}
252252
if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_LOOKUP_JOIN_ON_MANY_FIELDS)) {
253253
planOut.writeCollection(matchFields, (o, matchConfig) -> matchConfig.writeTo(o));
254+
} else if (matchFields.size() > 1) {
255+
throw new EsqlIllegalArgumentException("LOOKUP JOIN on multiple fields is not supported on remote node");
254256
}
255257
}
256258

0 commit comments

Comments
 (0)