Skip to content

Commit

Permalink
Enable non-match queries in custom filters
Browse files Browse the repository at this point in the history
filterManager.add assumes that if it finds a filter that has a query
prop, then it must also have a match clause contained in that query.

User created custom filters may use term queries, range queries and
the like. Once you've added any filters without a match clause like
that,
you can no longer add new filters by clicking the "add filter" icon
next to a field in the results. Instead you'll get an error that says
"Cannot read property '<your-prop>' of undefined" when filterManager.add
iterates over your custom filter with no match key.

Fixes: elastic#7246
Related: elastic#8038
  • Loading branch information
Bargs committed Aug 22, 2016
1 parent a254b7e commit a067db0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/public/filter_manager/filter_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function (Private) {
return filter.exists.field === value;
}

if (filter.query) {
if (filter.query && filter.query.match) {
return filter.query.match[fieldName] && filter.query.match[fieldName].query === value;
}

Expand Down

0 comments on commit a067db0

Please sign in to comment.