1111import org .elasticsearch .common .io .stream .NamedWriteableRegistry ;
1212import org .elasticsearch .common .io .stream .StreamInput ;
1313import org .elasticsearch .common .io .stream .StreamOutput ;
14+ import org .elasticsearch .index .query .MatchQueryBuilder ;
1415import org .elasticsearch .index .query .QueryBuilder ;
1516import org .elasticsearch .xpack .esql .capabilities .PostAnalysisPlanVerificationAware ;
1617import 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