-
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
fixing boolean filters #15927
fixing boolean filters #15927
Conversation
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 fix should probably go in the phrase
filter constructor itself. We already have the same conversion logic there for scripted fields.
kibana/src/ui/public/filter_manager/lib/phrase.js
Lines 35 to 43 in 013b794
function getConvertedValueForField(field, value) { | |
if (typeof value !== 'boolean' && field.type === 'boolean') { | |
if (value !== 1 && value !== 0) { | |
throw new Error('Boolean scripted fields must return true or false'); | |
} | |
return value === 1 ? true : false; | |
} | |
return value; | |
} |
I'm also wondering whether this is breaking people's saved objects and we just haven't heard about it. Say someone saved one of these filters with 0/1 on a vis or dashboard in 5.x. When they try to load that object in 6.x it's going to error, right? I wonder if we should also convert those legacy filters at query time so users don't have to go through and fix everything manually. We already do this for one legacy syntax:
export function migrateFilter(filter) { |
ad32471
to
e69e0f7
Compare
i confirmed with @Bargs that this is now a good approach |
resolves #15114
release notes: filtering on boolean fields works again