Skip to content

Commit

Permalink
Stop sending null in ip range from/to props
Browse files Browse the repository at this point in the history
The IP range agg supports open ended ranges. Elasticsearch 2.x was
lenient and accepted null as a value for the from/to props, but the
correct way to do an open ended range was always to omit the from/to
key entirely. ES 5.0 appears to be more strict and barfs when null is
passed. This commit removes the null values.

Fixes elastic#8741
  • Loading branch information
Bargs authored and nreese committed Nov 10, 2016
1 parent d77aad4 commit 7157ba3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ui/public/agg_types/buckets/ip_range.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ export default function RangeAggDefinition(Private) {
},
editor: ipRangesTemplate,
write: function (aggConfig, output) {
let ipRangeType = aggConfig.params.ipRangeType;
output.params.ranges = aggConfig.params.ranges[ipRangeType];
const ipRangeType = aggConfig.params.ipRangeType;
let ranges = aggConfig.params.ranges[ipRangeType];

if (ipRangeType === 'fromTo') {
ranges = _.map(ranges, (range) => {
return _.omit(range, _.isNull);
});
}

output.params.ranges = ranges;
}
}
]
Expand Down

0 comments on commit 7157ba3

Please sign in to comment.