mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[TSDB][Discover] Exclude counter fields from Breakdown options (#155532)
Closes https://github.com/elastic/kibana/issues/155143 ## Summary This PR excludes time series counter fields (like `bytes_counter`) from "Break down by" options in the histogram.
This commit is contained in:
parent
a108b8c9c6
commit
1bbaa5a62f
2 changed files with 19 additions and 1 deletions
|
@ -31,5 +31,20 @@ describe('fieldSupportsBreakdown', () => {
|
|||
expect(
|
||||
fieldSupportsBreakdown({ aggregatable: true, scripted: false, type: 'string' } as any)
|
||||
).toBe(true);
|
||||
|
||||
expect(
|
||||
fieldSupportsBreakdown({ aggregatable: true, scripted: false, type: 'number' } as any)
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false if field is aggregatable but it is a time series counter metric', () => {
|
||||
expect(
|
||||
fieldSupportsBreakdown({
|
||||
aggregatable: true,
|
||||
scripted: false,
|
||||
type: 'number',
|
||||
timeSeriesMetric: 'counter',
|
||||
} as any)
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,4 +11,7 @@ import { DataViewField } from '@kbn/data-views-plugin/public';
|
|||
const supportedTypes = new Set(['string', 'boolean', 'number', 'ip']);
|
||||
|
||||
export const fieldSupportsBreakdown = (field: DataViewField) =>
|
||||
supportedTypes.has(field.type) && field.aggregatable && !field.scripted;
|
||||
supportedTypes.has(field.type) &&
|
||||
field.aggregatable &&
|
||||
!field.scripted &&
|
||||
field.timeSeriesMetric !== 'counter';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue