Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Search Source] Update search source to use minimal data view spec for serialization #169460

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

davismcphee
Copy link
Contributor

@davismcphee davismcphee commented Oct 19, 2023

Summary

Currently we use the full data view spec whenever we serialize fields for a search source with an ad hoc data view, except when otherwise specified (currently only when serializing for alert URLs). As a result, whenever we persist a serialized search source containing an ad hoc data view within a saved object, we end up persisting the entire data view field list as well. For data views that target hundreds or thousands of fields, this can result in huge saved objects that exceed Kibana's max payload size, causing issues like the one seen in #168573.

Does it ever make sense to persist the full data view spec now that we have a minimal spec (strips all field list data except popularity counts, custom labels, etc.)? I don't think it does, so this PR updates search source to always use the minimal data view spec for ad hoc data views, limiting the impact of large field lists. Barring a good reason not to do this, I think we should make this the standard behaviour.

Fixes #168573.

Checklist

For maintainers

@davismcphee davismcphee added Feature:Search Querying infrastructure in Kibana release_note:fix Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.11.0 v8.12.0 labels Oct 19, 2023
@davismcphee davismcphee self-assigned this Oct 19, 2023
@davismcphee davismcphee force-pushed the search-source-minimal-spec branch 2 times, most recently from f802017 to 8c97bde Compare October 22, 2023 19:26
@davismcphee davismcphee marked this pull request as ready for review October 23, 2023 15:21
@davismcphee davismcphee requested review from a team as code owners October 23, 2023 15:21
@elasticmachine
Copy link
Contributor

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

@kertal
Copy link
Member

kertal commented Oct 25, 2023

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Defend Workflows Cypress Tests on Serverless #1 / When accessing Endpoint Response Console from Cases "before all" hook for "should display responder option in take action menu" "before all" hook for "should display responder option in take action menu"

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
data 2537 2535 -2

Async chunks

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

id before after diff
discover 585.5KB 585.4KB -6.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 409.5KB 409.5KB +1.0B
Unknown metric groups

API count

id before after diff
data 3186 3184 -2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @davismcphee

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Makes sense to exclude serialized fields. Fields formatting and runtime fields are preserved with toMinimalSpec().

Copy link
Contributor

@drewdaemon drewdaemon left a comment

Choose a reason for hiding this comment

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

Search is owned by Discover

@davismcphee davismcphee merged commit f0bf4d2 into elastic:main Oct 26, 2023
29 checks passed
@davismcphee davismcphee deleted the search-source-minimal-spec branch October 26, 2023 13:51
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.11

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 26, 2023
…r serialization (elastic#169460)

## Summary

Currently we use the full data view spec whenever we serialize fields
for a search source with an ad hoc data view, except when otherwise
specified (currently only when serializing for alert URLs). As a result,
whenever we persist a serialized search source containing an ad hoc data
view within a saved object, we end up persisting the entire data view
field list as well. For data views that target hundreds or thousands of
fields, this can result in huge saved objects that exceed Kibana's max
payload size, causing issues like the one seen in elastic#168573.

Does it ever make sense to persist the full data view spec now that we
have a minimal spec (strips all field list data except popularity
counts, custom labels, etc.)? I don't think it does, so this PR updates
search source to always use the minimal data view spec for ad hoc data
views, limiting the impact of large field lists. Barring a good reason
not to do this, I think we should make this the standard behaviour.

Fixes elastic#168573.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit f0bf4d2)
kibanamachine added a commit that referenced this pull request Oct 26, 2023
…spec for serialization (#169460) (#169941)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Search Source] Update search source to use minimal data view spec
for serialization
(#169460)](#169460)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Davis
McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2023-10-26T13:51:05Z","message":"[Search
Source] Update search source to use minimal data view spec for
serialization (#169460)\n\n## Summary\r\n\r\nCurrently we use the full
data view spec whenever we serialize fields\r\nfor a search source with
an ad hoc data view, except when otherwise\r\nspecified (currently only
when serializing for alert URLs). As a result,\r\nwhenever we persist a
serialized search source containing an ad hoc data\r\nview within a
saved object, we end up persisting the entire data view\r\nfield list as
well. For data views that target hundreds or thousands of\r\nfields,
this can result in huge saved objects that exceed Kibana's
max\r\npayload size, causing issues like the one seen in
#168573.\r\n\r\nDoes it ever make sense to persist the full data view
spec now that we\r\nhave a minimal spec (strips all field list data
except popularity\r\ncounts, custom labels, etc.)? I don't think it
does, so this PR updates\r\nsearch source to always use the minimal data
view spec for ad hoc data\r\nviews, limiting the impact of large field
lists. Barring a good reason\r\nnot to do this, I think we should make
this the standard behaviour.\r\n\r\nFixes #168573.\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"f0bf4d2e9536ed74fb3ea13d75f23c5b305b5817","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Search","release_note:fix","Team:DataDiscovery","v8.11.0","v8.12.0"],"number":169460,"url":"https://github.com/elastic/kibana/pull/169460","mergeCommit":{"message":"[Search
Source] Update search source to use minimal data view spec for
serialization (#169460)\n\n## Summary\r\n\r\nCurrently we use the full
data view spec whenever we serialize fields\r\nfor a search source with
an ad hoc data view, except when otherwise\r\nspecified (currently only
when serializing for alert URLs). As a result,\r\nwhenever we persist a
serialized search source containing an ad hoc data\r\nview within a
saved object, we end up persisting the entire data view\r\nfield list as
well. For data views that target hundreds or thousands of\r\nfields,
this can result in huge saved objects that exceed Kibana's
max\r\npayload size, causing issues like the one seen in
#168573.\r\n\r\nDoes it ever make sense to persist the full data view
spec now that we\r\nhave a minimal spec (strips all field list data
except popularity\r\ncounts, custom labels, etc.)? I don't think it
does, so this PR updates\r\nsearch source to always use the minimal data
view spec for ad hoc data\r\nviews, limiting the impact of large field
lists. Barring a good reason\r\nnot to do this, I think we should make
this the standard behaviour.\r\n\r\nFixes #168573.\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"f0bf4d2e9536ed74fb3ea13d75f23c5b305b5817"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/169460","number":169460,"mergeCommit":{"message":"[Search
Source] Update search source to use minimal data view spec for
serialization (#169460)\n\n## Summary\r\n\r\nCurrently we use the full
data view spec whenever we serialize fields\r\nfor a search source with
an ad hoc data view, except when otherwise\r\nspecified (currently only
when serializing for alert URLs). As a result,\r\nwhenever we persist a
serialized search source containing an ad hoc data\r\nview within a
saved object, we end up persisting the entire data view\r\nfield list as
well. For data views that target hundreds or thousands of\r\nfields,
this can result in huge saved objects that exceed Kibana's
max\r\npayload size, causing issues like the one seen in
#168573.\r\n\r\nDoes it ever make sense to persist the full data view
spec now that we\r\nhave a minimal spec (strips all field list data
except popularity\r\ncounts, custom labels, etc.)? I don't think it
does, so this PR updates\r\nsearch source to always use the minimal data
view spec for ad hoc data\r\nviews, limiting the impact of large field
lists. Barring a good reason\r\nnot to do this, I think we should make
this the standard behaviour.\r\n\r\nFixes #168573.\r\n\r\n###
Checklist\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n-
[ ] Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"f0bf4d2e9536ed74fb3ea13d75f23c5b305b5817"}}]}]
BACKPORT-->

Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
bryce-b pushed a commit to bryce-b/kibana that referenced this pull request Oct 30, 2023
…r serialization (elastic#169460)

## Summary

Currently we use the full data view spec whenever we serialize fields
for a search source with an ad hoc data view, except when otherwise
specified (currently only when serializing for alert URLs). As a result,
whenever we persist a serialized search source containing an ad hoc data
view within a saved object, we end up persisting the entire data view
field list as well. For data views that target hundreds or thousands of
fields, this can result in huge saved objects that exceed Kibana's max
payload size, causing issues like the one seen in elastic#168573.

Does it ever make sense to persist the full data view spec now that we
have a minimal spec (strips all field list data except popularity
counts, custom labels, etc.)? I don't think it does, so this PR updates
search source to always use the minimal data view spec for ad hoc data
views, limiting the impact of large field lists. Barring a good reason
not to do this, I think we should make this the standard behaviour.

Fixes elastic#168573.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
awahab07 pushed a commit to awahab07/kibana that referenced this pull request Oct 31, 2023
…r serialization (elastic#169460)

## Summary

Currently we use the full data view spec whenever we serialize fields
for a search source with an ad hoc data view, except when otherwise
specified (currently only when serializing for alert URLs). As a result,
whenever we persist a serialized search source containing an ad hoc data
view within a saved object, we end up persisting the entire data view
field list as well. For data views that target hundreds or thousands of
fields, this can result in huge saved objects that exceed Kibana's max
payload size, causing issues like the one seen in elastic#168573.

Does it ever make sense to persist the full data view spec now that we
have a minimal spec (strips all field list data except popularity
counts, custom labels, etc.)? I don't think it does, so this PR updates
search source to always use the minimal data view spec for ad hoc data
views, limiting the impact of large field lists. Barring a good reason
not to do this, I think we should make this the standard behaviour.

Fixes elastic#168573.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Search Querying infrastructure in Kibana release_note:fix Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.11.0 v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security Solution]discover search error on saving timeline
7 participants