-
Notifications
You must be signed in to change notification settings - Fork 8.6k
better error message for using invalid field in agg #16413
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,7 +79,12 @@ export function FieldParamTypeProvider(Private, $filter) { | |
|
|
||
| const validField = this.getFieldOptions(aggConfig).byName[fieldName]; | ||
| if (!validField) { | ||
| notifier.error(`Saved "field" parameter is now invalid. Please select a new field.`); | ||
| // check to see if a .raw field exists and use it if it does | ||
| const validRawField = this.getFieldOptions(aggConfig).byName[`${fieldName}.raw`]; | ||
| if (validRawField) { | ||
| return validRawField; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should probably display an "info" notification when we change the field, so the user is aware of what's going on. It's possible they're intentionally trying to aggregate on a |
||
| } | ||
| notifier.error(`Field "${fieldName}" is not aggregatable. Please replace it with a keyword version of the field.`); | ||
| } | ||
|
|
||
| return validField; | ||
|
|
||
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 won't work for newer fields using the
.keywordconvention. More generally, these names are just a convention, users can name theirkeywordmulti fields anything they want. It would be nice if we interrogated the mappings and actually detected when a multi field exists instead of relying on names. Of course, that would blow this tiny change up into big change. We've needed knowledge about multi fields for a long time though :) At the very least, we should check for.keywordin addition to.raw.