Skip to content

Commit bfb5fa9

Browse files
Add lenient as default
1 parent c1d4157 commit bfb5fa9

File tree

1 file changed

+6
-4
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 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.Failures;
@@ -344,11 +345,12 @@ public Expression options() {
344345
}
345346

346347
private Map<String, Object> getOptions() throws InvalidArgumentException {
348+
Map<String, Object> options = new HashMap<>();
349+
options.put(MatchQueryBuilder.LENIENT_FIELD.getPreferredName(), true);
347350
if (options() == null) {
348-
return null;
351+
return options;
349352
}
350353

351-
Map<String, Object> matchOptions = new HashMap<>();
352354
for (EntryExpression entry : ((MapExpression) options()).entryExpressions()) {
353355
Expression optionExpr = entry.key();
354356
Expression valueExpr = entry.value();
@@ -366,15 +368,15 @@ private Map<String, Object> getOptions() throws InvalidArgumentException {
366368
);
367369
}
368370
try {
369-
matchOptions.put(optionName, DataTypeConverter.convert(optionValue, dataType));
371+
options.put(optionName, DataTypeConverter.convert(optionValue, dataType));
370372
} catch (InvalidArgumentException e) {
371373
throw new InvalidArgumentException(
372374
format(null, "Invalid option [{}] in [{}], {}", optionName, sourceText(), e.getMessage())
373375
);
374376
}
375377
}
376378

377-
return matchOptions;
379+
return options;
378380
}
379381

380382
@Override

0 commit comments

Comments
 (0)