Skip to content

[9.2] [SLO] Fix SLO filter containing space and wildcard (#251033)#251197

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

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

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 9.2:

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)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label Feb 2, 2026
@kibanamachine kibanamachine enabled auto-merge (squash) February 2, 2026 09:25
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] x-pack/solutions/security/test/cloud_security_posture_functional/config.ts / Cloud Security Posture Test adding Cloud Security Posture Integrations CSPM AWS CIS_AWS Organization Manual Temporary Keys CIS_AWS Organization Manual Temporary Keys Workflow

History

cc @mgiota

@kibanamachine kibanamachine merged commit a9a719a into elastic:9.2 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