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

[Query] Remove es query dependency on format.convert #103174

Merged
merged 6 commits into from
Jun 27, 2021

Conversation

lizozom
Copy link
Contributor

@lizozom lizozom commented Jun 23, 2021

Summary

Part of #51659

Removes the dependency of ES query on field.format.convert
Filter display values are not handled by the filter mappers.

Testing

Make sure that the following work:

  • Formatting of a phrases filter with a custom formatter (one of list) - currently a regression
  • Formatting of a phrases filter without a custom formatter
  • Formatting of a range filter on a date field
  • Formatting of a range filter on a numeric scripted field

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@lizozom lizozom added v8.0.0 Team:AppServices release_note:skip Skip the PR/issue when compiling release notes v7.14.0 labels Jun 23, 2021
@lizozom lizozom self-assigned this Jun 23, 2021
@lizozom lizozom requested a review from a team as a code owner June 23, 2021 20:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@@ -60,7 +55,7 @@ export const buildPhrasesFilter = (
}

return {
meta: { index, type, key, value, params },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We actually weren't using the field formatter correctly here, showing the non-formatted values on the filter.
I assume this is a regression from the new index patterns changes.


const format = (field: IFieldType, value: any) =>
field && field.format && field.format.convert ? field.format.convert(value) : value;
map(params, (val: any, key: string) => get(operators, key) + val).join(' ');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This value wan't used, as map_range already builds it's own label.

Copy link
Member

@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.

LGTM. Tested and things seem to be formatted properly.

@lizozom lizozom added the auto-backport Deprecated - use backport:version if exact versions are needed label Jun 27, 2021
@lizozom
Copy link
Contributor Author

lizozom commented Jun 27, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

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

id before after diff
data 833.3KB 833.2KB -155.0B

History

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

cc @lizozom

@lizozom lizozom merged commit 07af5d3 into elastic:master Jun 27, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Jun 27, 2021
* remove es query dependency on format.convert

* fix types

* types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

jloleysens added a commit to jloleysens/kibana that referenced this pull request Jun 28, 2021
…-png-pdf-report-type

* 'master' of github.com:elastic/kibana: (253 commits)
  [Enterprise Search] Test coverage pass (elastic#103406)
  [App Search] Success toast polish pass  (elastic#103410)
  Role mappings: remove deprecated reset copy (elastic#103411)
  [Fleet] Add a message when log collection is disabled on the log details page (elastic#103166)
  [Query]  Remove es query dependency on format.convert (elastic#103174)
  Home & Kibana Overview Page Template Update (elastic#103003)
  [ML] Converts management app jobs list pages to new layout (elastic#103117)
  Allow additive csp configuration (elastic#102059)
  [Lens] Document common formulas in product and add formula tutorial (elastic#103154)
  [Lens] Enable actions on Lens Embeddable (elastic#102038)
  [Osquery] Return proper indices permissions for osquery_manager package (elastic#103363)
  Dashboard locator (elastic#102854)
  Maps locators (elastic#102810)
  [Fleet] Add support for constant_keyword "value" in package field definitions (elastic#103000)
  [Maps] Add capability to delete features from layer & index (elastic#103145)
  [Security Solution] Correct linux OS lookup for Endpoint Exceptions (elastic#103038)
  [Enterprise Search] Add notices for deactivated users and SMTP callout (elastic#103285)
  [canvas] Reduce bundle size by combining SCSS imports (elastic#102822)
  [Enterprise Search] Final KibanaPageTemplate cleanup (elastic#103355)
  [docs][migrations v2] Update SO migration docs to include removal of index write block when handling corrupt SOs. (elastic#103014)
  ...
jloleysens added a commit to jloleysens/kibana that referenced this pull request Jun 28, 2021
…-policy-2

* 'master' of github.com:elastic/kibana: (190 commits)
  [Enterprise Search] Test coverage pass (elastic#103406)
  [App Search] Success toast polish pass  (elastic#103410)
  Role mappings: remove deprecated reset copy (elastic#103411)
  [Fleet] Add a message when log collection is disabled on the log details page (elastic#103166)
  [Query]  Remove es query dependency on format.convert (elastic#103174)
  Home & Kibana Overview Page Template Update (elastic#103003)
  [ML] Converts management app jobs list pages to new layout (elastic#103117)
  Allow additive csp configuration (elastic#102059)
  [Lens] Document common formulas in product and add formula tutorial (elastic#103154)
  [Lens] Enable actions on Lens Embeddable (elastic#102038)
  [Osquery] Return proper indices permissions for osquery_manager package (elastic#103363)
  Dashboard locator (elastic#102854)
  Maps locators (elastic#102810)
  [Fleet] Add support for constant_keyword "value" in package field definitions (elastic#103000)
  [Maps] Add capability to delete features from layer & index (elastic#103145)
  [Security Solution] Correct linux OS lookup for Endpoint Exceptions (elastic#103038)
  [Enterprise Search] Add notices for deactivated users and SMTP callout (elastic#103285)
  [canvas] Reduce bundle size by combining SCSS imports (elastic#102822)
  [Enterprise Search] Final KibanaPageTemplate cleanup (elastic#103355)
  [docs][migrations v2] Update SO migration docs to include removal of index write block when handling corrupt SOs. (elastic#103014)
  ...

# Conflicts:
#	x-pack/plugins/reporting/server/lib/store/store.test.ts
#	x-pack/plugins/reporting/server/lib/store/store.ts
lizozom added a commit to lizozom/kibana that referenced this pull request Jun 28, 2021
* remove es query dependency on format.convert

* fix types

* types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jun 28, 2021
* remove es query dependency on format.convert

* fix types

* types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Liza Katz <lizka.k@gmail.com>
Co-authored-by: Liza K <liza.katz@elastic.co>
@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.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 29, 2021
@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.

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.

@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants