[8.x] [ES|QL] Hide "not" operators from suggestions menu (#216355) (#216533)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] Hide "not" operators from suggestions menu
(#216355)](https://github.com/elastic/kibana/pull/216355)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Drew
Tate","email":"drew.tate@elastic.co"},"sourceCommit":{"committedDate":"2025-03-31T19:25:08Z","message":"[ES|QL]
Hide \"not\" operators from suggestions menu (#216355)\n\n##
Summary\n\nin https://github.com/elastic/kibana/pull/205565 we
accidentally removed\nthe behavior where we don't show `NOT LIKE` and
`NOT RLIKE` in the\nsuggestions list. We want to show these eventually
but right now, it's\nbroken
behavior:\n\n\n\nhttps://github.com/user-attachments/assets/0a7f860d-3a12-49cf-94b3-668848cff6ae\n\n---------\n\nCo-authored-by:
Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"4970bb95ccb99b7cedfde51a3f4d56906607e28d","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Feature:ES|QL","Team:ESQL","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[ES|QL]
Hide \"not\" operators from suggestions
menu","number":216355,"url":"https://github.com/elastic/kibana/pull/216355","mergeCommit":{"message":"[ES|QL]
Hide \"not\" operators from suggestions menu (#216355)\n\n##
Summary\n\nin https://github.com/elastic/kibana/pull/205565 we
accidentally removed\nthe behavior where we don't show `NOT LIKE` and
`NOT RLIKE` in the\nsuggestions list. We want to show these eventually
but right now, it's\nbroken
behavior:\n\n\n\nhttps://github.com/user-attachments/assets/0a7f860d-3a12-49cf-94b3-668848cff6ae\n\n---------\n\nCo-authored-by:
Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"4970bb95ccb99b7cedfde51a3f4d56906607e28d"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216355","number":216355,"mergeCommit":{"message":"[ES|QL]
Hide \"not\" operators from suggestions menu (#216355)\n\n##
Summary\n\nin https://github.com/elastic/kibana/pull/205565 we
accidentally removed\nthe behavior where we don't show `NOT LIKE` and
`NOT RLIKE` in the\nsuggestions list. We want to show these eventually
but right now, it's\nbroken
behavior:\n\n\n\nhttps://github.com/user-attachments/assets/0a7f860d-3a12-49cf-94b3-668848cff6ae\n\n---------\n\nCo-authored-by:
Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"4970bb95ccb99b7cedfde51a3f4d56906607e28d"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Drew Tate <drew.tate@elastic.co>
This commit is contained in:
Kibana Machine 2025-03-31 23:21:58 +02:00 committed by GitHub
parent a75155043b
commit ffee696919
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -712,7 +712,7 @@ const enrichOperators = (
const isInOperator = op.name === 'in' || op.name === 'not_in';
const isLikeOperator = /like/i.test(op.name);
const isNotOperator =
op.name?.toLowerCase()?.startsWith('not_') && (isInOperator || isInOperator);
op.name?.toLowerCase()?.startsWith('not_') && (isInOperator || isLikeOperator);
let signatures = op.signatures.map((s) => ({
...s,
@ -844,7 +844,7 @@ function printGeneratedFunctionsFile(
name: '${functionName}',
description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.${name}', { defaultMessage: ${JSON.stringify(
removeAsciiDocInternalCrossReferences(removeInlineAsciiDocLinks(description), functionNames)
)} }),${functionDefinition.ignoreAsSuggestion ? 'ignoreAsSuggestion: true,\n' : ''}
)} }),${functionDefinition.ignoreAsSuggestion ? 'ignoreAsSuggestion: true,' : ''}
preview: ${functionDefinition.preview || 'false'},
alias: ${alias ? `['${alias.join("', '")}']` : 'undefined'},
signatures: ${JSON.stringify(signatures, null, 2)},

View file

@ -3828,7 +3828,6 @@ const notInDefinition: FunctionDefinition = {
'The `NOT IN` operator allows testing whether a field or expression does *not* equal any element in a list of literals, fields or expressions.',
}),
ignoreAsSuggestion: true,
preview: false,
alias: undefined,
signatures: [
@ -4070,6 +4069,7 @@ const notLikeDefinition: FunctionDefinition = {
defaultMessage:
'Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`\nusually acts on a field placed on the left-hand side of the operator, but it can\nalso act on a constant (literal) expression. The right-hand side of the operator\nrepresents the pattern.\n\nThe following wildcard characters are supported:\n\n* `*` matches zero or more characters.\n* `?` matches one character.',
}),
ignoreAsSuggestion: true,
preview: false,
alias: undefined,
signatures: [
@ -4119,6 +4119,7 @@ const notRlikeDefinition: FunctionDefinition = {
defaultMessage:
'Use `RLIKE` to filter data based on string patterns using using\nregular expressions. `RLIKE` usually acts on a field placed on\nthe left-hand side of the operator, but it can also act on a constant (literal)\nexpression. The right-hand side of the operator represents the pattern.',
}),
ignoreAsSuggestion: true,
preview: false,
alias: undefined,
signatures: [