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

[ML] Transforms: Support for terms agg in pivot configurations. #123634

Merged
merged 7 commits into from
Jan 27, 2022

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Jan 24, 2022

Summary

Part of #123459.

Adds support for the terms agg for transform pivot configurations.

Checklist

@walterra walterra marked this pull request as ready for review January 25, 2022 08:11
@walterra walterra requested a review from a team as a code owner January 25, 2022 08:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

}
isInvalid={!validSize}
>
<EuiFieldText defaultValue={sizeText} onChange={(e) => updateSize(e.target.value)} />
Copy link
Contributor

Choose a reason for hiding this comment

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

size is a number type, shall we use https://elastic.github.io/eui/#/forms/form-controls#number-field control instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remember we intentionally went with the text field in other cases too because we had problems in the past with custom validations. So for consistency I went with the text based one here again. See the input for 'Maximum page search size' for example.

Copy link
Contributor

Choose a reason for hiding this comment

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

Found EuiFieldNumber in

. But in case you still experience issues with custom validation we can stick to the text field

Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth another look at EuiFieldNumber as currently it silently accepts fractional values (rounding down to nearest integer):

image

Copy link
Contributor Author

@walterra walterra Jan 26, 2022

Choose a reason for hiding this comment

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

Thanks for the additional feedback, I switched to EuiFieldNumber in 4878e18. Looking into this, I noticed the form validation approach I copied over from the percentiles variant was a bit flawed. I fixed that in the same commit. For both percentiles and size it's now validating the input string and keeping that as separate state. Previously, similar like the screenshot above with a float not triggering an error, for percentiles it also wouldn't show an error but just fall back to the default value when applied.

const sampleDoc = sample(docs) ?? {};
const missingMappings = difference(Object.keys(sampleDoc), Object.keys(populatedProperties));
// Identify missing mappings
const missingMappings = difference(
Copy link
Contributor

Choose a reason for hiding this comment

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

The grid isn't inferring the type of the value correctly - it thinks it's a string, so left aligns the cell contents, and gives the alphabetical sort options (note sort isn't working on nested fields but I will raise a separate issue for that).

image

Copy link
Contributor

Choose a reason for hiding this comment

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

It makes sense to address this as part of #123796 as even if the type for the terms agg columns is correctly set to numeric it still won't be sorted correctly as the column name will contain a dot.

@walterra walterra mentioned this pull request Jan 26, 2022
13 tasks
Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest changes and LGTM.
We should look at the issues with the type and sorting of the preview columns in #123796.

@walterra
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

LGTM

@kibana-ci
Copy link
Collaborator

💚 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
transform 364.7KB 365.8KB +1.1KB

History

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

cc @walterra

@walterra walterra merged commit b8b7edf into elastic:main Jan 27, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 27, 2022
@walterra walterra deleted the ml-transform-terms-agg branch January 27, 2022 10:57
@peteharverson peteharverson added the release_note:feature Makes this part of the condensed release notes label Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Transforms ML transforms :ml release_note:feature Makes this part of the condensed release notes v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants