Skip to content

[Background search] Restore unsaved dashboards#240067

Merged
AlexGPlay merged 2 commits intoelastic:mainfrom
AlexGPlay:227311-restore-unsaved-dashboards
Oct 31, 2025
Merged

[Background search] Restore unsaved dashboards#240067
AlexGPlay merged 2 commits intoelastic:mainfrom
AlexGPlay:227311-restore-unsaved-dashboards

Conversation

@AlexGPlay
Copy link
Copy Markdown
Contributor

@AlexGPlay AlexGPlay commented Oct 22, 2025

Summary

Closes #227311

Right now if we create a background search of an unsaved dashboard it doesn't store the panels/references in the saved object, that menas that we can't really restore it. With this we store them even if the dashboard isn't saved but I don't have any context on why it wasn't done like this before so happy to get input on it.


Background an unsaved dashboard and just open it again

Before

unsaved_before_1.mov

After

unsaved_after_1.mov

Background an unsaved dashboard, remove it and open it again

Before

unsaved_before_2.mov

After

unsaved_after_2.mov

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@AlexGPlay AlexGPlay force-pushed the 227311-restore-unsaved-dashboards branch from 02d209c to 322b77c Compare October 22, 2025 14:22
@AlexGPlay AlexGPlay self-assigned this Oct 23, 2025
@AlexGPlay AlexGPlay added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Project:AsyncSearch Background search, partial results, async search services. Feature:Search Sessions backport:version Backport to applied version labels v9.2.0 v9.3.0 Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// and removed backport:skip This PR does not require backporting labels Oct 23, 2025
@AlexGPlay
Copy link
Copy Markdown
Contributor Author

I don't have any context on why we weren't storing this panels/references when the dashboard wasn't saved so happy to get input here - if we are happy with this I can add a couple of functional tests for the scenarios in the videos

@AlexGPlay AlexGPlay marked this pull request as ready for review October 23, 2025 07:55
@AlexGPlay AlexGPlay requested a review from a team as a code owner October 23, 2025 07:55
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@kertal
Copy link
Copy Markdown
Member

kertal commented Oct 23, 2025

dear @nreese it seems this code @AlexGPlay is now working on was changed in #224314, so would the given change be in conflict with this PR, could you provide some context, thx!

@nreese
Copy link
Copy Markdown
Contributor

nreese commented Oct 23, 2025

dear @nreese it seems this code @AlexGPlay is now working on was changed in #224314, so would the given change be in conflict with this PR, could you provide some context, thx!

Before #224314, see image below, search session state was also not containing panels when savedObjectId was not provided. So these changes do not conflict with changes from #224314. I am not sure why the savedObjectId check was originally added. Maybe @ThomThomson can provide more context?

Screenshot 2025-10-23 at 10 49 39 AM

@kertal kertal requested a review from lukasolson October 23, 2025 18:18
@kertal
Copy link
Copy Markdown
Member

kertal commented Oct 23, 2025

@nreese ah, thx, you're right, seems it has been that way forever? I could track it down until #144332 , wonder if this ever worked?

@ThomThomson
Copy link
Copy Markdown
Contributor

I don't have any context on this. It seems to me that is incorrect behaviour - when there is no saved object ID, we require the panels information the most.

@kertal
Copy link
Copy Markdown
Member

kertal commented Oct 24, 2025

if we are happy with this I can add a couple of functional tests for the scenarios in the videos

thx for all your input. for me this sound like we can move forward, and adding a couple of functional tests sounds like a great plan to bring this over the finishing line

@AlexGPlay AlexGPlay requested a review from a team as a code owner October 24, 2025 10:10
@AlexGPlay AlexGPlay force-pushed the 227311-restore-unsaved-dashboards branch from 75c5884 to 931bc30 Compare October 24, 2025 13:49
Copy link
Copy Markdown
Contributor

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

Great find! Things seem to be working properly now. LGTM

@AlexGPlay AlexGPlay force-pushed the 227311-restore-unsaved-dashboards branch from 931bc30 to 40a18aa Compare October 27, 2025 09:48
Copy link
Copy Markdown
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presentation changes LGTM
code review only

@AlexGPlay AlexGPlay force-pushed the 227311-restore-unsaved-dashboards branch from 40a18aa to 5da8a32 Compare October 30, 2025 13:43
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Oct 30, 2025

💔 Build Failed

Failed CI Steps

History

cc @AlexGPlay

@AlexGPlay AlexGPlay force-pushed the 227311-restore-unsaved-dashboards branch from 5da8a32 to 62efa3e Compare October 31, 2025 07:45
@AlexGPlay AlexGPlay added v9.2.1 and removed v9.2.0 labels Oct 31, 2025
@AlexGPlay AlexGPlay merged commit 9686335 into elastic:main Oct 31, 2025
15 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.2

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

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

Closes elastic#227311

Right now if we create a background search of an unsaved dashboard it
doesn't store the panels/references in the saved object, that menas that
we can't really restore it. With this we store them even if the
dashboard isn't saved but I don't have any context on why it wasn't done
like this before so happy to get input on it.

---

#### Background an unsaved dashboard and just open it again

Before

https://github.com/user-attachments/assets/fd282c28-53ea-49dc-b58b-1441e25dfbb1

After

https://github.com/user-attachments/assets/d39fbef0-d9b2-4763-bd10-1db98b4fc667

---

#### Background an unsaved dashboard, remove it and open it again

Before

https://github.com/user-attachments/assets/9c1ba24d-a55f-4176-a409-5070d282110d

After

https://github.com/user-attachments/assets/7d0a4e3e-e213-40f4-9c41-50783a08b2df

---

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] [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
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

(cherry picked from commit 9686335)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
9.2

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 Oct 31, 2025
# Backport

This will backport the following commits from `main` to `9.2`:
- [[Background search] Restore unsaved dashboards
(#240067)](#240067)

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

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

<!--BACKPORT [{"author":{"name":"Alejandro García
Parrondo","email":"31973472+AlexGPlay@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-10-31T09:35:46Z","message":"[Background
search] Restore unsaved dashboards (#240067)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/227311\n\nRight now if we
create a background search of an unsaved dashboard it\ndoesn't store the
panels/references in the saved object, that menas that\nwe can't really
restore it. With this we store them even if the\ndashboard isn't saved
but I don't have any context on why it wasn't done\nlike this before so
happy to get input on it.\n\n---\n\n#### Background an unsaved dashboard
and just open it
again\n\nBefore\n\n\nhttps://github.com/user-attachments/assets/fd282c28-53ea-49dc-b58b-1441e25dfbb1\n\nAfter\n\n\nhttps://github.com/user-attachments/assets/d39fbef0-d9b2-4763-bd10-1db98b4fc667\n\n---\n\n####
Background an unsaved dashboard, remove it and open it
again\n\nBefore\n\n\nhttps://github.com/user-attachments/assets/9c1ba24d-a55f-4176-a409-5070d282110d\n\n\nAfter\n\n\nhttps://github.com/user-attachments/assets/7d0a4e3e-e213-40f4-9c41-50783a08b2df\n\n---\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] [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\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"968633561559bfb774bd6e38ffd4c56c859317b8","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Project:AsyncSearch","Team:DataDiscovery","Feature:Search
Sessions","backport:version","v9.3.0","v9.2.1"],"title":"[Background
search] Restore unsaved
dashboards","number":240067,"url":"https://github.com/elastic/kibana/pull/240067","mergeCommit":{"message":"[Background
search] Restore unsaved dashboards (#240067)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/227311\n\nRight now if we
create a background search of an unsaved dashboard it\ndoesn't store the
panels/references in the saved object, that menas that\nwe can't really
restore it. With this we store them even if the\ndashboard isn't saved
but I don't have any context on why it wasn't done\nlike this before so
happy to get input on it.\n\n---\n\n#### Background an unsaved dashboard
and just open it
again\n\nBefore\n\n\nhttps://github.com/user-attachments/assets/fd282c28-53ea-49dc-b58b-1441e25dfbb1\n\nAfter\n\n\nhttps://github.com/user-attachments/assets/d39fbef0-d9b2-4763-bd10-1db98b4fc667\n\n---\n\n####
Background an unsaved dashboard, remove it and open it
again\n\nBefore\n\n\nhttps://github.com/user-attachments/assets/9c1ba24d-a55f-4176-a409-5070d282110d\n\n\nAfter\n\n\nhttps://github.com/user-attachments/assets/7d0a4e3e-e213-40f4-9c41-50783a08b2df\n\n---\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] [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\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"968633561559bfb774bd6e38ffd4c56c859317b8"}},"sourceBranch":"main","suggestedTargetBranches":["9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240067","number":240067,"mergeCommit":{"message":"[Background
search] Restore unsaved dashboards (#240067)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/227311\n\nRight now if we
create a background search of an unsaved dashboard it\ndoesn't store the
panels/references in the saved object, that menas that\nwe can't really
restore it. With this we store them even if the\ndashboard isn't saved
but I don't have any context on why it wasn't done\nlike this before so
happy to get input on it.\n\n---\n\n#### Background an unsaved dashboard
and just open it
again\n\nBefore\n\n\nhttps://github.com/user-attachments/assets/fd282c28-53ea-49dc-b58b-1441e25dfbb1\n\nAfter\n\n\nhttps://github.com/user-attachments/assets/d39fbef0-d9b2-4763-bd10-1db98b4fc667\n\n---\n\n####
Background an unsaved dashboard, remove it and open it
again\n\nBefore\n\n\nhttps://github.com/user-attachments/assets/9c1ba24d-a55f-4176-a409-5070d282110d\n\n\nAfter\n\n\nhttps://github.com/user-attachments/assets/7d0a4e3e-e213-40f4-9c41-50783a08b2df\n\n---\n\n###
Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers
should verify this PR satisfies this list as well.\n\n- [ ] [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\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*`
labels.","sha":"968633561559bfb774bd6e38ffd4c56c859317b8"}},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Alejandro García Parrondo <31973472+AlexGPlay@users.noreply.github.com>
ana-davydova pushed a commit to ana-davydova/kibana that referenced this pull request Nov 3, 2025
## Summary

Closes elastic#227311

Right now if we create a background search of an unsaved dashboard it
doesn't store the panels/references in the saved object, that menas that
we can't really restore it. With this we store them even if the
dashboard isn't saved but I don't have any context on why it wasn't done
like this before so happy to get input on it.

---

#### Background an unsaved dashboard and just open it again

Before


https://github.com/user-attachments/assets/fd282c28-53ea-49dc-b58b-1441e25dfbb1

After


https://github.com/user-attachments/assets/d39fbef0-d9b2-4763-bd10-1db98b4fc667

---

#### Background an unsaved dashboard, remove it and open it again

Before


https://github.com/user-attachments/assets/9c1ba24d-a55f-4176-a409-5070d282110d


After


https://github.com/user-attachments/assets/7d0a4e3e-e213-40f4-9c41-50783a08b2df

---

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] [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
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
albertoblaz pushed a commit to albertoblaz/kibana that referenced this pull request Nov 4, 2025
## Summary

Closes elastic#227311

Right now if we create a background search of an unsaved dashboard it
doesn't store the panels/references in the saved object, that menas that
we can't really restore it. With this we store them even if the
dashboard isn't saved but I don't have any context on why it wasn't done
like this before so happy to get input on it.

---

#### Background an unsaved dashboard and just open it again

Before


https://github.com/user-attachments/assets/fd282c28-53ea-49dc-b58b-1441e25dfbb1

After


https://github.com/user-attachments/assets/d39fbef0-d9b2-4763-bd10-1db98b4fc667

---

#### Background an unsaved dashboard, remove it and open it again

Before


https://github.com/user-attachments/assets/9c1ba24d-a55f-4176-a409-5070d282110d


After


https://github.com/user-attachments/assets/7d0a4e3e-e213-40f4-9c41-50783a08b2df

---

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] [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
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
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 Feature:Search Sessions Project:AsyncSearch Background search, partial results, async search services. release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v9.2.1 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Background search] Restoring a background search containing a Discover session from an unsaved dashboard is empty

7 participants