Skip to content

[SLO] Fix SLO filter containing space and wildcard#251033

Merged
mgiota merged 6 commits intoelastic:mainfrom
mgiota:slo-filter-fix
Feb 2, 2026
Merged

[SLO] Fix SLO filter containing space and wildcard#251033
mgiota merged 6 commits intoelastic:mainfrom
mgiota:slo-filter-fix

Conversation

@mgiota
Copy link
Contributor

@mgiota mgiota commented Jan 30, 2026

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 (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() 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

542489023-4f0a0439-3615-436b-a265-132a929563f9

SLO documents flyout showing only documents with hello all tag

Screenshot 2026-01-30 at 01 43 04

@github-actions github-actions bot added the author:actionable-obs PRs authored by the actionable obs team label Jan 30, 2026
@mgiota mgiota self-assigned this Jan 30, 2026
@mgiota mgiota added Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. v9.4.0 release_note:fix backport:version Backport to applied version labels labels Jan 30, 2026
@mgiota mgiota marked this pull request as ready for review January 30, 2026 12:13
@mgiota mgiota requested a review from a team as a code owner January 30, 2026 12:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/actionable-obs-team (Team:actionable-obs)

@kdelemme kdelemme self-requested a review January 30, 2026 12:23
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
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 1.1MB 1.1MB +19.0B

History

cc @mgiota

Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and code lgtm 👍🏻

import { isEmpty } from 'lodash';

export function getElasticsearchQueryOrThrow(kuery: QuerySchema = ''): QueryDslQueryContainer {
export function getElasticsearchQueryOrThrow(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe rename getSafeElasticsearchQuery() and remove the comment in the catch clause :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged the PR since it was green. I'll create a tiny PR with this change

@kdelemme
Copy link
Contributor

kdelemme commented Feb 1, 2026

We won't make it for 8.19.11, but maybe if there is a 8.19.12

@mgiota mgiota merged commit 96eb62c into elastic:main Feb 2, 2026
22 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/21584174717

kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Feb 2, 2026
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 added a commit to kibanamachine/kibana that referenced this pull request Feb 2, 2026
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
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.19 Backport failed because of merge conflicts
9.2
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 251033

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 4, 2026
@kibanamachine
Copy link
Contributor

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.
cc: @mgiota

1 similar comment
@kibanamachine
Copy link
Contributor

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.
cc: @mgiota

@mgiota
Copy link
Contributor Author

mgiota commented Feb 5, 2026

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

mgiota added a commit to mgiota/kibana that referenced this pull request Feb 5, 2026
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
kibanamachine added a commit that referenced this pull request Feb 5, 2026
…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>
kibanamachine added a commit that referenced this pull request Feb 5, 2026
…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>
mgiota added a commit that referenced this pull request Feb 5, 2026
…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-->
@kibanamachine kibanamachine added v8.19.12 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:actionable-obs PRs authored by the actionable obs team backport:version Backport to applied version labels release_note:fix Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. Team:obs-ux-management v8.19.11 v8.19.12 v9.2.5 v9.2.6 v9.3.0 v9.3.1 v9.4.0

Projects

None yet

4 participants