-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Do not apply search source data for tsvb #75137
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
Pinging @elastic/kibana-app-arch (Team:AppArch) |
@elasticmachine merge upstream |
@@ -490,8 +490,8 @@ export const buildPipeline = async ( | |||
} | |||
) => { | |||
const { indexPattern, searchSource } = vis.data; | |||
const query = searchSource!.getField('query'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is used for the kibana_context function, and should be irrelevant to the visualizaiton. tsvb function can ignore those if it wishes to, but shouldnt in my opinion, as we want it to work outside of visualize context as well.
so i think the actual problem is why is there a searchSource query set for tsvb saved objects, if it shouldn't be as there is no query bar in tsvb application ?
we should probably try to address that problem directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is used for the kibana_context function, and should be irrelevant to the visualizaiton
In case of TSVB, the visualization is using the kibana_context
passed in as input to do its data fetching. It needs to do so to get filter and query of the current dashboard and time range, but it shouldn't use the search source of the saved object, because it should be empty anyway.
I agree this is not a super clean fix, but it's meant as a temporary measure to fix the referenced bug till we can remove build_pipeline
completely and make tsvb code responsible for its complete expression. When we do this, we can just not use kibana_context
at all and choose to not deserialize the saved search source (right now this is happening automatically for all visualizations).
so i think the actual problem is why is there a searchSource query set for tsvb saved objects, if it shouldn't be as there is no query bar in tsvb application ?
I agree it shouldn't, but for now it has to have one because that's how the visualization saved object is structured and in some exotic cases (multiple updates, auto generated saved objects) actual data ends up in there, causing the referenced bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current plan was to not give tsvb control over that part of expression, visualize frame/embeddable would handle that internally.
any idea why we have those queries on the saved objects ? (why its not empty for tsvb) ?
- lets make sure we fix that (so new tsvb panels no longer have that problem)
- we can write a simple migration script (or migrate on the fly inside update_vis_state) to remove those if we know that none of saved tsvbs should have those set.
@ppisljar I changed the approach and added a migration removing the searchSourceJSON for tsvb visualizations. This should have the same effect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code LGTM, can you please also update the description of the PR ?
thanks!
💚 Build SucceededBuild metrics
History
To update your PR or re-run it, just comment with: |
…' of github.com:jloleysens/kibana into ilm/fix/pre-existing-policy-with-no-existing-repository * 'ilm/fix/pre-existing-policy-with-no-existing-repository' of github.com:jloleysens/kibana: fix empty string in selected indices (elastic#76855) [Security Solution] Refactor OverviewHost and OverviewNetwork to use Search Strategy (elastic#76409) Use Search API in Timelion (sync) (elastic#75115) [telemetry] expose getIsOptedIn function in plugin start contract (elastic#75143) [ILM] Clean up remaining js files and any typings (elastic#76803) [Logs UI] Shared `<LogStream />` component (elastic#76262) [Security Solution] Add unit test for all hosts (elastic#76752) [Security Solution] Add unit test for authentications search strategy (elastic#76665) Do not apply search source data for tsvb (elastic#75137) [Security Solution] Refactor NetworkDns to use Search Strategy (elastic#76250) [SECURITY SOLUTION] Adds 'cypress:open-as-ci' command (elastic#76125) [Logs UI] Update alert executor tests (elastic#75764) [Functional] Unskip vega tests and fix flakiness (elastic#76600) [Data] Query String Input accepts classname prop (elastic#76848) [ML] Swim lane pagination for viewing by job id (elastic#76847) [Security Solution] Refactor MatrixHistogram to use Search Strategy (elastic#76603) [APM] Use the outcome field to calculate the transaction error rate chart (elastic#75528) [APM] Use observer.hostname instead of observer.name (elastic#76074) Legacy logging: fix remoteAddress being duplicated in userAgent field (elastic#76751)
…s-for-710 * 'master' of github.com:elastic/kibana: [Search] Use async es client endpoints (elastic#76872) fix empty string in selected indices (elastic#76855) [Security Solution] Refactor OverviewHost and OverviewNetwork to use Search Strategy (elastic#76409) Use Search API in Timelion (sync) (elastic#75115) [telemetry] expose getIsOptedIn function in plugin start contract (elastic#75143) [ILM] Clean up remaining js files and any typings (elastic#76803) [Logs UI] Shared `<LogStream />` component (elastic#76262) [Security Solution] Add unit test for all hosts (elastic#76752) [Security Solution] Add unit test for authentications search strategy (elastic#76665) Do not apply search source data for tsvb (elastic#75137) [Security Solution] Refactor NetworkDns to use Search Strategy (elastic#76250) [SECURITY SOLUTION] Adds 'cypress:open-as-ci' command (elastic#76125) [Logs UI] Update alert executor tests (elastic#75764) [Functional] Unskip vega tests and fix flakiness (elastic#76600) [Data] Query String Input accepts classname prop (elastic#76848) [ML] Swim lane pagination for viewing by job id (elastic#76847) [Security Solution] Refactor MatrixHistogram to use Search Strategy (elastic#76603) [APM] Use the outcome field to calculate the transaction error rate chart (elastic#75528) [APM] Use observer.hostname instead of observer.name (elastic#76074) Legacy logging: fix remoteAddress being duplicated in userAgent field (elastic#76751) # Conflicts: # x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.tsx # x-pack/plugins/index_lifecycle_management/common/types/index.ts # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/node_allocation.tsx # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx # x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/phases/warm_phase.tsx # x-pack/plugins/index_lifecycle_management/public/application/services/api.ts
Fixes #74959
In some cases, TSVB visualizations have outdated data in their serialized search source JSON. As TSVB doesn't support the query bar, it should never use these, but as it's sharing infrastructure with Visualize, it will use it if it contains a query or filters.
This PR only puts the query and filters from search source on the expression if it's not writing a TSVB expression. Mid-term TSVB should build its complete expression on its own using a separate
toExpression
function - when this happens, this workaround can be removed and the logic for honoring search source can simply be omitted from the TSVB specific logic.Release note
In some old TSVB visualization saved objects, queries and filters can be stored. This is not possible anymore for a while and there is no way to edit them besides changing the JSON of the saved object, but they were still applied to the rendered output. In 7.10, these leftover queries and filters will be removed automatically from the saved object. In almost all cases, no change is necessary. If a visualization contained these local queries and filters deliberately, they should be converted to panel filters in the "Panel options" of the TSVB interface.