Skip to content

[9.3] [SLO] Fix SLO filter containing space and wildcard (#251033)#251198

Merged
kibanamachine merged 3 commits intoelastic:9.3from
kibanamachine:backport/9.3/pr-251033
Feb 5, 2026
Merged

[9.3] [SLO] Fix SLO filter containing space and wildcard (#251033)#251198
kibanamachine merged 3 commits intoelastic:9.3from
kibanamachine:backport/9.3/pr-251033

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.3:

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)
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
slo 995.7KB 995.7KB +21.0B

History

cc @mgiota

@kibanamachine kibanamachine merged commit aa5af86 into elastic:9.3 Feb 5, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR Team:obs-ux-management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants