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

Cleanup unnecessary params for date_histogram #20710

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,41 +132,4 @@ describe('params', function () {
});
});

describe('extended_bounds', function () {
it('should write a long value if a moment passed in', function () {
const then = moment(0);
const now = moment(500);
const output = paramWriter.write({
extended_bounds: {
min: then,
max: now
}
});

expect(typeof output.params.extended_bounds.min).to.be('number');
expect(typeof output.params.extended_bounds.max).to.be('number');
expect(output.params.extended_bounds.min).to.be(then.valueOf());
expect(output.params.extended_bounds.max).to.be(now.valueOf());


});

it('should write a long if a long is passed', function () {
const then = 0;
const now = 500;
const output = paramWriter.write({
extended_bounds: {
min: then,
max: now
}
});

expect(typeof output.params.extended_bounds.min).to.be('number');
expect(typeof output.params.extended_bounds.max).to.be('number');
expect(output.params.extended_bounds.min).to.be(then.valueOf());
expect(output.params.extended_bounds.max).to.be(now.valueOf());


});
});
});
22 changes: 0 additions & 22 deletions src/ui/public/agg_types/buckets/date_histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,27 +157,5 @@ export const dateHistogramBucketAgg = new BucketAggType({
{
name: 'format'
},

{
name: 'min_doc_count',
default: 1
},

{
name: 'extended_bounds',
default: {},
write: function (agg, output) {
const val = agg.params.extended_bounds;

if (val.min != null || val.max != null) {
output.params.extended_bounds = {
min: moment(val.min).valueOf(),
max: moment(val.max).valueOf()
};

return;
}
}
}
]
});