Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [NL-to-ESQL] autocorrect bad LIKE wildcards (#202464) #202631

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

## Summary

Part of elastic#198942

Add autocorrect for wrong `LIKE` wildcard.

The LLM can make mistake and use SQL wildcards for LIKE operators (`_`
instead of `?` and `%` instead of `*`)

Examples

**generated**
```
FROM logs | WHERE message LIKE "a%" AND TO_UPPER(level) LIKE "err%" | WHERE foo LIKE "ba_"
```
**corrected**
```
FROM logs | WHERE message LIKE "a*" AND TO_UPPER(level) LIKE "err*" | WHERE foo LIKE "ba?"
```

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 2ace6ff)
@kibanamachine kibanamachine merged commit 06256a3 into elastic:8.x Dec 3, 2024
11 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

cc @pgayvallet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants