Skip to content

Commit

Permalink
Ensure min_doc_count set to false in lens histograms.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeelmers committed Dec 9, 2020
1 parent 061748a commit d4037ed
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,54 @@ describe('ranges', () => {
'col1',
{} as IndexPattern
);
expect(esAggsFn).toMatchInlineSnapshot(`
Object {
"arguments": Object {
"enabled": Array [
true,
],
"extended_bounds": Array [
"{\\"min\\":\\"\\",\\"max\\":\\"\\"}",
],
"field": Array [
"MyField",
],
"has_extended_bounds": Array [
false,
],
"id": Array [
"col1",
],
"interval": Array [
"auto",
],
"min_doc_count": Array [
false,
],
"schema": Array [
"segment",
],
},
"function": "aggHistogram",
"type": "function",
}
`);
});

it('should set maxBars param if provided', () => {
(state.layers.first.columns.col1 as RangeIndexPatternColumn).params.maxBars = 10;

const esAggsFn = rangeOperation.toEsAggsFn(
state.layers.first.columns.col1 as RangeIndexPatternColumn,
'col1',
{} as IndexPattern
);

expect(esAggsFn).toEqual(
expect.objectContaining({
function: 'aggHistogram',
arguments: expect.objectContaining({
field: [sourceField],
maxBars: [10],
}),
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const rangeOperation: OperationDefinition<RangeIndexPatternColumn, 'field
maxBars: params.maxBars === AUTO_BARS ? undefined : params.maxBars,
interval: 'auto',
has_extended_bounds: false,
min_doc_count: true,
min_doc_count: false,
extended_bounds: JSON.stringify({ min: '', max: '' }),
}).toAst();
},
Expand Down

0 comments on commit d4037ed

Please sign in to comment.