Skip to content

Commit 7632048

Browse files
Always apply lenient
1 parent 81026bc commit 7632048

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/multi-match-function.csv-spec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ testMultiMatchWithOptionsMinimumShouldMatch
4343
required_capability: multi_match_unified_function
4444

4545
from books
46-
| where match(title, description, "here back again", {"minimum_should_match": 2, "operator": "OR"})
46+
| where match(title, description, "there back again", {"minimum_should_match": 2, "operator": "AND"})
4747
| sort book_no
4848
| keep title;
4949

5050
title:text
51-
My First 100 Words in Spanish/English (My First 100 Words Pull-Tab Book)
5251
The Hobbit or There and Back Again
5352
;
5453

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1212
import org.elasticsearch.common.io.stream.StreamInput;
1313
import org.elasticsearch.common.io.stream.StreamOutput;
14+
import org.elasticsearch.index.query.MatchQueryBuilder;
1415
import org.elasticsearch.index.query.QueryBuilder;
1516
import org.elasticsearch.xpack.esql.capabilities.PostAnalysisPlanVerificationAware;
1617
import org.elasticsearch.xpack.esql.common.Failure;
@@ -512,6 +513,7 @@ protected Query translate(TranslatorHandler handler) {
512513
return new MultiMatchQuery(source(), Objects.toString(queryAsObject()), fieldsWithBoost, options);
513514
} else {
514515
// Translate to Match when having exactly one field.
516+
options.put(MatchQueryBuilder.LENIENT_FIELD.getPreferredName(), true);
515517
return new MatchQuery(source(), fieldsWithBoost.keySet().stream().findFirst().get(), queryAsObject(), options);
516518
}
517519
}

0 commit comments

Comments
 (0)