Skip to content

Comments

[Investigations][Bug] - Fix alert page filtering by checking for empty dataView#235144

Merged
michaelolo24 merged 4 commits intoelastic:mainfrom
michaelolo24:fix-alert-page-filtering
Sep 16, 2025
Merged

[Investigations][Bug] - Fix alert page filtering by checking for empty dataView#235144
michaelolo24 merged 4 commits intoelastic:mainfrom
michaelolo24:fix-alert-page-filtering

Conversation

@michaelolo24
Copy link
Contributor

@michaelolo24 michaelolo24 commented Sep 15, 2025

Summary

This PR fixes an issue with the alert page filtering when the below configuration is enabled:

image

When enabled, the config looks to make sure that searches are only done against index patterns that are mapped to the given dataView. This configuration is utilized in a utility function here

return !ignoreFilterIfFieldNotInIndex || filterMatchesIndex(filter, indexPattern);
that is used across security solution for querying.

When introducing the code to migrate to our new dataView picker here in the following PR #225726, a check was done to only apply the new DataView when it was provided. To fix a separate issue regarding flashing of the alerts page when loading, a default empty data view was introduced to fix the initial flash with the following initial dataView and was introduced with this pr: #225675.

In short, the empty dataView object was always defined, which only caused problems when this setting was turned on, because the field being filtered on was being checked against an empty dataView. It's not reproducible otherwise. And the impact area is limited to just SecuritySolution

There were no tests to account for this configuration, but those were added here to prevent this from occurring again.

The necessary checks are added in this PR

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

@michaelolo24 michaelolo24 added bug Fixes for quality problems that affect the customer experience release_note:fix Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team backport:version Backport to applied version labels v9.1.4 labels Sep 15, 2025
@michaelolo24 michaelolo24 marked this pull request as ready for review September 15, 2025 21:12
@michaelolo24 michaelolo24 requested a review from a team as a code owner September 15, 2025 21:12
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this! I left a couple of minor non-blocker comments.

If I understand correctly, this was introduced in 9.1 but kind of fixed/hidden by my alerts page refactor PR, as in this one we don't display anything until the dataView is fully ready... That's why we couldn't reproduce it on main, correct?

filters: Filter[];
}): [string, undefined] | [undefined, Error] => {
try {
const newDataViewExists = dataView?.id && dataView?.title;
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for using title here which is deprecated? Why not using getIndexPattern()?
Also maybe even better, we could use this hasMatchedIndices function?

Copy link
Contributor Author

@michaelolo24 michaelolo24 Sep 16, 2025

Choose a reason for hiding this comment

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

I'll change it, but the definition for getIndexPattern() is

  getIndexPattern = () => this.title;

😅. And I'm not using matchedIndices as the check is primarily against whether or not the dataView is empty (our INIT_DV in useDataView.ts) vs whether there are any matching indices in the env. I would prefer to pass down the newDataViewPickerEnabled check, but the surface area for that change is larger for a patch fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll change it, but the definition for getIndexPattern() is getIndexPattern = () => this.title;

Yup yup I know, it's just if someone wants to remove the export of this.title then it's one less place to change 😉
Thanks for updating it!

@michaelolo24 michaelolo24 force-pushed the fix-alert-page-filtering branch from 4d712c0 to 769cc1f Compare September 15, 2025 23:05
@kqualters-elastic
Copy link
Contributor

desk tested that this fixed the bug on main, lgtm 👍

@kqualters-elastic
Copy link
Contributor

If I understand correctly, this was introduced in 9.1 but kind of fixed/hidden by my alerts page refactor PR, as in this one we don't display anything until the dataView is fully ready... That's why we couldn't reproduce it on main, correct?

I am able to reproduce on main, you need to enable the advanced setting: courier:ignoreFilterIfFieldNotInIndex: true to see it though.

@michaelolo24
Copy link
Contributor Author

If I understand correctly, this was introduced in 9.1 but kind of fixed/hidden by my alerts page refactor #222457, as in this one we don't display anything until the dataView is fully ready... That's why we couldn't reproduce it on main, correct?

@PhilippeOberti no not really. This one actually happens because by default we don't check if the field is in a given dataView when searching, if you follow the code path here:

return !ignoreFilterIfFieldNotInIndex || filterMatchesIndex(filter, indexPattern);
specifically filterMatchesIndex you'll see that the failure happens because the dataView that it's checking against doesn't actually have the fields since the useDataView always returns a dataView now..even though it's empty

@michaelolo24 michaelolo24 merged commit 128528c into elastic:main Sep 16, 2025
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.1

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

@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
securitySolution 10.5MB 10.5MB +62.0B

Saved Objects .kibana field count

Every field in each saved object type adds overhead to Elasticsearch. Kibana needs to keep the total field count below Elasticsearch's default limit of 1000 fields. Only specify field mappings for the fields you wish to search on or query. See https://www.elastic.co/guide/en/kibana/master/saved-objects-service.html#_mappings

id before after diff
_data_stream_timestamp 1 - -1
_doc_count 1 - -1
_ignored_source 1 - -1
_index_mode 1 - -1
_inference_fields 1 - -1
_tier 1 - -1
apm-custom-dashboards 5 - -5
apm-server-schema 2 - -2
apm-service-group 5 - -5
application_usage_daily 2 - -2
config 2 - -2
config-global 2 - -2
coreMigrationVersion 1 - -1
created_at 1 - -1
created_by 1 - -1
entity-definition 9 - -9
entity-discovery-api-key 2 - -2
event_loop_delays_daily 2 - -2
favorites 4 - -4
file 11 - -11
file-upload-usage-collection-telemetry 3 - -3
fileShare 5 - -5
infra-custom-dashboards 4 - -4
infrastructure-monitoring-log-view 2 - -2
intercept_trigger_record 5 - -5
legacy-url-alias 7 - -7
managed 1 - -1
ml-job 6 - -6
ml-module 13 - -13
ml-trained-model 7 - -7
monitoring-telemetry 2 - -2
namespace 1 - -1
namespaces 1 - -1
observability-onboarding-state 2 - -2
originId 1 - -1
product-doc-install-status 7 - -7
references 4 - -4
sample-data-telemetry 3 - -3
security-ai-prompt 8 - -8
slo 11 - -11
space 5 - -5
synthetics-monitor 34 - -34
synthetics-monitor-multi-space 34 - -34
tag 4 - -4
type 1 - -1
typeMigrationVersion 1 - -1
ui-metric 2 - -2
updated_at 1 - -1
updated_by 1 - -1
upgrade-assistant-ml-upgrade-operation 3 - -3
upgrade-assistant-reindex-operation 3 - -3
uptime-synthetics-api-key 2 - -2
url 5 - -5
usage-counters 2 - -2
total -246

History

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 16, 2025
## Summary

This PR fixes an issue with the alert page filtering when the below
config is enabled:

<img width="627" height="181" alt="image"
src="https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535"
/>

When enabled, the config looks to make sure that searches are only done
against index patterns that are mapped to the given dataView. When
introducing the code to migrate to our new dataView picker
[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)
in the following PR elastic#225726, a
check was done to only apply the new DataView when it was provided. To
fix a separate issue regarding flashing of the alerts page, this
following [initial
dataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)
was introduced with this pr:
elastic#225675

In short, the dataView object was always defined, even if it was just an
initial dataView leading to the fields being queried against not being
mapped.

The necessary checks are added in this PR

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 128528c)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 16, 2025
## Summary

This PR fixes an issue with the alert page filtering when the below
config is enabled:

<img width="627" height="181" alt="image"
src="https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535"
/>

When enabled, the config looks to make sure that searches are only done
against index patterns that are mapped to the given dataView. When
introducing the code to migrate to our new dataView picker
[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)
in the following PR elastic#225726, a
check was done to only apply the new DataView when it was provided. To
fix a separate issue regarding flashing of the alerts page, this
following [initial
dataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)
was introduced with this pr:
elastic#225675

In short, the dataView object was always defined, even if it was just an
initial dataView leading to the fields being queried against not being
mapped.

The necessary checks are added in this PR

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 128528c)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.1

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 16, 2025
…35214)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Investigations][Bug] - Check for empty dataView
(#235144)](#235144)

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

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

<!--BACKPORT [{"author":{"name":"Michael
Olorunnisola","email":"michael.olorunnisola@elastic.co"},"sourceCommit":{"committedDate":"2025-09-16T14:09:44Z","message":"[Investigations][Bug]
- Check for empty dataView (#235144)\n\n## Summary\n\nThis PR fixes an
issue with the alert page filtering when the below\nconfig is
enabled:\n\n<img width=\"627\" height=\"181\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535\"\n/>\n\nWhen
enabled, the config looks to make sure that searches are only
done\nagainst index patterns that are mapped to the given dataView.
When\nintroducing the code to migrate to our new dataView
picker\n[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)\nin
the following PR #225726, a\ncheck
was done to only apply the new DataView when it was provided. To\nfix a
separate issue regarding flashing of the alerts page, this\nfollowing
[initial\ndataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)\nwas
introduced with this
pr:\nhttps://github.com//pull/225675\n\nIn short, the
dataView object was always defined, even if it was just an\ninitial
dataView leading to the fields being queried against not
being\nmapped.\n\nThe necessary checks are added in this PR\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"128528cbfe123c5f0234824e5834755cab58b0c4","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Threat
Hunting:Investigations","backport:version","v9.2.0","v9.1.4","v8.19.4","v8.19.5","v9.1.5"],"title":"[Investigations][Bug]
- Check for empty
dataView","number":235144,"url":"https://github.com/elastic/kibana/pull/235144","mergeCommit":{"message":"[Investigations][Bug]
- Check for empty dataView (#235144)\n\n## Summary\n\nThis PR fixes an
issue with the alert page filtering when the below\nconfig is
enabled:\n\n<img width=\"627\" height=\"181\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535\"\n/>\n\nWhen
enabled, the config looks to make sure that searches are only
done\nagainst index patterns that are mapped to the given dataView.
When\nintroducing the code to migrate to our new dataView
picker\n[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)\nin
the following PR #225726, a\ncheck
was done to only apply the new DataView when it was provided. To\nfix a
separate issue regarding flashing of the alerts page, this\nfollowing
[initial\ndataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)\nwas
introduced with this
pr:\nhttps://github.com//pull/225675\n\nIn short, the
dataView object was always defined, even if it was just an\ninitial
dataView leading to the fields being queried against not
being\nmapped.\n\nThe necessary checks are added in this PR\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"128528cbfe123c5f0234824e5834755cab58b0c4"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/235144","number":235144,"mergeCommit":{"message":"[Investigations][Bug]
- Check for empty dataView (#235144)\n\n## Summary\n\nThis PR fixes an
issue with the alert page filtering when the below\nconfig is
enabled:\n\n<img width=\"627\" height=\"181\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535\"\n/>\n\nWhen
enabled, the config looks to make sure that searches are only
done\nagainst index patterns that are mapped to the given dataView.
When\nintroducing the code to migrate to our new dataView
picker\n[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)\nin
the following PR #225726, a\ncheck
was done to only apply the new DataView when it was provided. To\nfix a
separate issue regarding flashing of the alerts page, this\nfollowing
[initial\ndataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)\nwas
introduced with this
pr:\nhttps://github.com//pull/225675\n\nIn short, the
dataView object was always defined, even if it was just an\ninitial
dataView leading to the fields being queried against not
being\nmapped.\n\nThe necessary checks are added in this PR\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"128528cbfe123c5f0234824e5834755cab58b0c4"}},{"branch":"9.1","label":"v9.1.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
kibanamachine added a commit that referenced this pull request Sep 16, 2025
…5215)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Investigations][Bug] - Check for empty dataView
(#235144)](#235144)

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

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

<!--BACKPORT [{"author":{"name":"Michael
Olorunnisola","email":"michael.olorunnisola@elastic.co"},"sourceCommit":{"committedDate":"2025-09-16T14:09:44Z","message":"[Investigations][Bug]
- Check for empty dataView (#235144)\n\n## Summary\n\nThis PR fixes an
issue with the alert page filtering when the below\nconfig is
enabled:\n\n<img width=\"627\" height=\"181\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535\"\n/>\n\nWhen
enabled, the config looks to make sure that searches are only
done\nagainst index patterns that are mapped to the given dataView.
When\nintroducing the code to migrate to our new dataView
picker\n[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)\nin
the following PR #225726, a\ncheck
was done to only apply the new DataView when it was provided. To\nfix a
separate issue regarding flashing of the alerts page, this\nfollowing
[initial\ndataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)\nwas
introduced with this
pr:\nhttps://github.com//pull/225675\n\nIn short, the
dataView object was always defined, even if it was just an\ninitial
dataView leading to the fields being queried against not
being\nmapped.\n\nThe necessary checks are added in this PR\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"128528cbfe123c5f0234824e5834755cab58b0c4","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Threat
Hunting:Investigations","backport:version","v9.2.0","v9.1.4","v8.19.4","v8.19.5","v9.1.5"],"title":"[Investigations][Bug]
- Check for empty
dataView","number":235144,"url":"https://github.com/elastic/kibana/pull/235144","mergeCommit":{"message":"[Investigations][Bug]
- Check for empty dataView (#235144)\n\n## Summary\n\nThis PR fixes an
issue with the alert page filtering when the below\nconfig is
enabled:\n\n<img width=\"627\" height=\"181\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535\"\n/>\n\nWhen
enabled, the config looks to make sure that searches are only
done\nagainst index patterns that are mapped to the given dataView.
When\nintroducing the code to migrate to our new dataView
picker\n[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)\nin
the following PR #225726, a\ncheck
was done to only apply the new DataView when it was provided. To\nfix a
separate issue regarding flashing of the alerts page, this\nfollowing
[initial\ndataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)\nwas
introduced with this
pr:\nhttps://github.com//pull/225675\n\nIn short, the
dataView object was always defined, even if it was just an\ninitial
dataView leading to the fields being queried against not
being\nmapped.\n\nThe necessary checks are added in this PR\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"128528cbfe123c5f0234824e5834755cab58b0c4"}},"sourceBranch":"main","suggestedTargetBranches":["9.1","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/235144","number":235144,"mergeCommit":{"message":"[Investigations][Bug]
- Check for empty dataView (#235144)\n\n## Summary\n\nThis PR fixes an
issue with the alert page filtering when the below\nconfig is
enabled:\n\n<img width=\"627\" height=\"181\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535\"\n/>\n\nWhen
enabled, the config looks to make sure that searches are only
done\nagainst index patterns that are mapped to the given dataView.
When\nintroducing the code to migrate to our new dataView
picker\n[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)\nin
the following PR #225726, a\ncheck
was done to only apply the new DataView when it was provided. To\nfix a
separate issue regarding flashing of the alerts page, this\nfollowing
[initial\ndataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)\nwas
introduced with this
pr:\nhttps://github.com//pull/225675\n\nIn short, the
dataView object was always defined, even if it was just an\ninitial
dataView leading to the fields being queried against not
being\nmapped.\n\nThe necessary checks are added in this PR\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"128528cbfe123c5f0234824e5834755cab58b0c4"}},{"branch":"9.1","label":"v9.1.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
@michaelolo24 michaelolo24 changed the title [Investigations][Bug] - Check for empty dataView [Investigations][Bug] - Fix alert page filtering by checking for empty dataView Sep 17, 2025
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Sep 24, 2025
## Summary

This PR fixes an issue with the alert page filtering when the below
config is enabled:

<img width="627" height="181" alt="image"
src="https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535"
/>

When enabled, the config looks to make sure that searches are only done
against index patterns that are mapped to the given dataView. When
introducing the code to migrate to our new dataView picker
[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)
in the following PR elastic#225726, a
check was done to only apply the new DataView when it was provided. To
fix a separate issue regarding flashing of the alerts page, this
following [initial
dataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)
was introduced with this pr:
elastic#225675

In short, the dataView object was always defined, even if it was just an
initial dataView leading to the fields being queried against not being
mapped.

The necessary checks are added in this PR

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
niros1 pushed a commit that referenced this pull request Sep 30, 2025
## Summary

This PR fixes an issue with the alert page filtering when the below
config is enabled:

<img width="627" height="181" alt="image"
src="https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535"
/>

When enabled, the config looks to make sure that searches are only done
against index patterns that are mapped to the given dataView. When
introducing the code to migrate to our new dataView picker
[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)
in the following PR #225726, a
check was done to only apply the new DataView when it was provided. To
fix a separate issue regarding flashing of the alerts page, this
following [initial
dataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)
was introduced with this pr:
#225675

In short, the dataView object was always defined, even if it was just an
initial dataView leading to the fields being queried against not being
mapped.

The necessary checks are added in this PR

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
rylnd pushed a commit to rylnd/kibana that referenced this pull request Oct 17, 2025
## Summary

This PR fixes an issue with the alert page filtering when the below
config is enabled:

<img width="627" height="181" alt="image"
src="https://github.com/user-attachments/assets/39fc9a61-d794-407d-bea9-16792c9a6535"
/>

When enabled, the config looks to make sure that searches are only done
against index patterns that are mapped to the given dataView. When
introducing the code to migrate to our new dataView picker
[here](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/common/lib/kuery/index.ts#L231)
in the following PR elastic#225726, a
check was done to only apply the new DataView when it was provided. To
fix a separate issue regarding flashing of the alerts page, this
following [initial
dataView](https://github.com/elastic/kibana/blob/9659a525327b2e46478f45d03ce39103848361cc/x-pack/solutions/security/plugins/security_solution/public/data_view_manager/hooks/use_data_view.ts#L45)
was introduced with this pr:
elastic#225675

In short, the dataView object was always defined, even if it was just an
initial dataView leading to the fields being queried against not being
mapped.

The necessary checks are added in this PR

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience release_note:fix Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team v8.19.5 v9.1.4 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants