[SLO] Fix SLO filter containing space and wildcard#251033
[SLO] Fix SLO filter containing space and wildcard#251033mgiota merged 6 commits intoelastic:mainfrom
Conversation
…dcard being used instead of query_string
|
Pinging @elastic/actionable-obs-team (Team:actionable-obs) |
|
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @mgiota |
kdelemme
left a comment
There was a problem hiding this comment.
Tested locally and code lgtm 👍🏻
| import { isEmpty } from 'lodash'; | ||
|
|
||
| export function getElasticsearchQueryOrThrow(kuery: QuerySchema = ''): QueryDslQueryContainer { | ||
| export function getElasticsearchQueryOrThrow( |
There was a problem hiding this comment.
nit: Maybe rename getSafeElasticsearchQuery() and remove the comment in the catch clause :)
There was a problem hiding this comment.
I merged the PR since it was green. I'll create a tiny PR with this change
|
We won't make it for 8.19.11, but maybe if there is a 8.19.12 |
|
Starting backport for target branches: 8.19, 9.2, 9.3 https://github.com/elastic/kibana/actions/runs/21584174717 |
Fixes elastic#250781 Fixes elastic#251039 ## Summary Currently in SLO edit/create form when user uses a filter query that contains a space followed by a wildcard character (`tags: hello *`), it behaves as if it's using Lucene syntax instead of KQL (generates `query_string` queries instead of `wildcard` queries for keyword fields). `query_string` uses Lucene syntax which handles spaces and wildcards differently than KQL, leading to queries matching all documents or no documents instead of the intended subset. ## Root cause The `getElasticsearchQueryOrThrow` function accepts an optional `dataView` parameter that is required for `buildEsQuery` to determine field types (keyword vs text vs other types). With a missing dataView [getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)() can't find the field in the dataView, so it falls back to a field with no type info, causing `query_string` instead of `wildcard` This PR fixes various calls to `getElasticsearchQueryOrThrow` to include a `dataView`. It also fixes a visual issue with the preview chart, where it appeared to be empty where sliValue = 0. Now it shows a line at the 0% level for those time intervals where good events might be 0. ## After, tags: hello *, only hello all documents returned <img width="1126" height="465" alt="542489023-4f0a0439-3615-436b-a265-132a929563f9" src="https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e" /> ## SLO documents flyout showing only documents with hello all tag <img width="1308" height="528" alt="Screenshot 2026-01-30 at 01 43 04" src="https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 96eb62c)
Fixes elastic#250781 Fixes elastic#251039 ## Summary Currently in SLO edit/create form when user uses a filter query that contains a space followed by a wildcard character (`tags: hello *`), it behaves as if it's using Lucene syntax instead of KQL (generates `query_string` queries instead of `wildcard` queries for keyword fields). `query_string` uses Lucene syntax which handles spaces and wildcards differently than KQL, leading to queries matching all documents or no documents instead of the intended subset. ## Root cause The `getElasticsearchQueryOrThrow` function accepts an optional `dataView` parameter that is required for `buildEsQuery` to determine field types (keyword vs text vs other types). With a missing dataView [getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)() can't find the field in the dataView, so it falls back to a field with no type info, causing `query_string` instead of `wildcard` This PR fixes various calls to `getElasticsearchQueryOrThrow` to include a `dataView`. It also fixes a visual issue with the preview chart, where it appeared to be empty where sliValue = 0. Now it shows a line at the 0% level for those time intervals where good events might be 0. ## After, tags: hello *, only hello all documents returned <img width="1126" height="465" alt="542489023-4f0a0439-3615-436b-a265-132a929563f9" src="https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e" /> ## SLO documents flyout showing only documents with hello all tag <img width="1308" height="528" alt="Screenshot 2026-01-30 at 01 43 04" src="https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 96eb62c)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
Fixes elastic#250781 Fixes elastic#251039 ## Summary Currently in SLO edit/create form when user uses a filter query that contains a space followed by a wildcard character (`tags: hello *`), it behaves as if it's using Lucene syntax instead of KQL (generates `query_string` queries instead of `wildcard` queries for keyword fields). `query_string` uses Lucene syntax which handles spaces and wildcards differently than KQL, leading to queries matching all documents or no documents instead of the intended subset. ## Root cause The `getElasticsearchQueryOrThrow` function accepts an optional `dataView` parameter that is required for `buildEsQuery` to determine field types (keyword vs text vs other types). With a missing dataView [getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)() can't find the field in the dataView, so it falls back to a field with no type info, causing `query_string` instead of `wildcard` This PR fixes various calls to `getElasticsearchQueryOrThrow` to include a `dataView`. It also fixes a visual issue with the preview chart, where it appeared to be empty where sliValue = 0. Now it shows a line at the 0% level for those time intervals where good events might be 0. ## After, tags: hello *, only hello all documents returned <img width="1126" height="465" alt="542489023-4f0a0439-3615-436b-a265-132a929563f9" src="https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e" /> ## SLO documents flyout showing only documents with hello all tag <img width="1308" height="528" alt="Screenshot 2026-01-30 at 01 43 04" src="https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 96eb62c) # Conflicts: # x-pack/solutions/observability/plugins/slo/common/parse_kuery.ts # x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.ts # x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_histogram_indicator_aggregation.ts
…251197) # Backport This will backport the following commits from `main` to `9.2`: - [[SLO] Fix SLO filter containing space and wildcard (#251033)](#251033) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Panagiota Mitsopoulou","email":"panagiota.mitsopoulou@elastic.co"},"sourceCommit":{"committedDate":"2026-02-02T09:17:02Z","message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:actionable-obs","backport:version","v9.4.0","author:actionable-obs","Team:obs-ux-management","v9.2.5","v8.19.11","v9.3.1"],"title":"[SLO] Fix SLO filter containing space and wildcard","number":251033,"url":"https://github.com/elastic/kibana/pull/251033","mergeCommit":{"message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","8.19","9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/251033","number":251033,"mergeCommit":{"message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.11","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Panagiota Mitsopoulou <panagiota.mitsopoulou@elastic.co> Co-authored-by: Shahzad <shahzad31comp@gmail.com>
…251198) # Backport This will backport the following commits from `main` to `9.3`: - [[SLO] Fix SLO filter containing space and wildcard (#251033)](#251033) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Panagiota Mitsopoulou","email":"panagiota.mitsopoulou@elastic.co"},"sourceCommit":{"committedDate":"2026-02-02T09:17:02Z","message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:actionable-obs","backport:version","v9.4.0","author:actionable-obs","Team:obs-ux-management","v9.2.5","v8.19.11","v9.3.1"],"title":"[SLO] Fix SLO filter containing space and wildcard","number":251033,"url":"https://github.com/elastic/kibana/pull/251033","mergeCommit":{"message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","8.19","9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/251033","number":251033,"mergeCommit":{"message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.11","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Panagiota Mitsopoulou <panagiota.mitsopoulou@elastic.co> Co-authored-by: Shahzad <shahzad31comp@gmail.com>
…251951) # Backport This will backport the following commits from `main` to `8.19`: - [[SLO] Fix SLO filter containing space and wildcard (#251033)](#251033) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Panagiota Mitsopoulou","email":"panagiota.mitsopoulou@elastic.co"},"sourceCommit":{"committedDate":"2026-02-02T09:17:02Z","message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport missing","Team:actionable-obs","backport:version","v9.4.0","author:actionable-obs","Team:obs-ux-management","v9.2.5","v8.19.11","v9.3.1"],"title":"[SLO] Fix SLO filter containing space and wildcard","number":251033,"url":"https://github.com/elastic/kibana/pull/251033","mergeCommit":{"message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/251033","number":251033,"mergeCommit":{"message":"[SLO] Fix SLO filter containing space and wildcard (#251033)\n\nFixes https://github.com/elastic/kibana/issues/250781\nFixes https://github.com/elastic/kibana/issues/251039\n\n## Summary\n\nCurrently in SLO edit/create form when user uses a filter query that\ncontains a space followed by a wildcard character (`tags: hello *`), it\nbehaves as if it's using Lucene syntax instead of KQL (generates\n`query_string` queries instead of `wildcard` queries for keyword\nfields). `query_string` uses Lucene syntax which handles spaces and\nwildcards differently than KQL, leading to queries matching all\ndocuments or no documents instead of the intended subset.\n\n## Root cause\nThe `getElasticsearchQueryOrThrow` function accepts an optional\n`dataView` parameter that is required for `buildEsQuery` to determine\nfield types (keyword vs text vs other types). With a missing dataView\n[getFields](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es-query/src/kuery/functions/utils/get_fields.ts#L14)()\ncan't find the field in the dataView, so it falls back to a field with\nno type info, causing `query_string` instead of `wildcard`\n\n\nThis PR fixes various calls to `getElasticsearchQueryOrThrow` to include\na `dataView`. It also fixes a visual issue with the preview chart, where\nit appeared to be empty where sliValue = 0. Now it shows a line at the\n0% level for those time intervals where good events might be 0.\n\n## After, tags: hello *, only hello all documents returned\n\n\n<img width=\"1126\" height=\"465\"\nalt=\"542489023-4f0a0439-3615-436b-a265-132a929563f9\"\nsrc=\"https://github.com/user-attachments/assets/48267637-2b8d-48ae-ac41-bf452804ab7e\"\n/>\n\n## SLO documents flyout showing only documents with hello all tag\n\n<img width=\"1308\" height=\"528\" alt=\"Screenshot 2026-01-30 at 01 43 04\"\nsrc=\"https://github.com/user-attachments/assets/dc880ca9-6baa-4a72-a8be-0d6e0a52fcda\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"96eb62cfbe06cf210adf56ed71b70d5e618b87ec"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/251197","number":251197,"state":"OPEN"},{"branch":"8.19","label":"v8.19.11","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/251198","number":251198,"state":"OPEN"}]}] BACKPORT-->
Fixes #250781
Fixes #251039
Summary
Currently in SLO edit/create form when user uses a filter query that contains a space followed by a wildcard character (
tags: hello *), it behaves as if it's using Lucene syntax instead of KQL (generatesquery_stringqueries instead ofwildcardqueries for keyword fields).query_stringuses Lucene syntax which handles spaces and wildcards differently than KQL, leading to queries matching all documents or no documents instead of the intended subset.Root cause
The
getElasticsearchQueryOrThrowfunction accepts an optionaldataViewparameter that is required forbuildEsQueryto determine field types (keyword vs text vs other types). With a missing dataView getFields() can't find the field in the dataView, so it falls back to a field with no type info, causingquery_stringinstead ofwildcardThis PR fixes various calls to
getElasticsearchQueryOrThrowto include adataView. It also fixes a visual issue with the preview chart, where it appeared to be empty where sliValue = 0. Now it shows a line at the 0% level for those time intervals where good events might be 0.After, tags: hello *, only hello all documents returned
SLO documents flyout showing only documents with hello all tag