-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Transforms: Fixes chart histograms for runtime fields. (#93028)
Fixes chart histograms for runtime fields. The runtime field configurations were not passed on to the endpoint to fetch the charts data, so charts ended up being empty with a 0 documents legend.
- Loading branch information
1 parent
a44d5a6
commit 769d245
Showing
22 changed files
with
250 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export interface NumericDataItem { | ||
key: number; | ||
key_as_string?: string | number; | ||
doc_count: number; | ||
} | ||
|
||
export interface NumericChartData { | ||
data: NumericDataItem[]; | ||
id: string; | ||
interval: number; | ||
stats: [number, number]; | ||
type: 'numeric'; | ||
} | ||
|
||
export const isNumericChartData = (arg: any): arg is NumericChartData => { | ||
return ( | ||
typeof arg === 'object' && | ||
arg.hasOwnProperty('data') && | ||
arg.hasOwnProperty('id') && | ||
arg.hasOwnProperty('interval') && | ||
arg.hasOwnProperty('stats') && | ||
arg.hasOwnProperty('type') && | ||
arg.type === 'numeric' | ||
); | ||
}; | ||
|
||
export interface OrdinalDataItem { | ||
key: string; | ||
key_as_string?: string; | ||
doc_count: number; | ||
} | ||
|
||
export interface OrdinalChartData { | ||
cardinality: number; | ||
data: OrdinalDataItem[]; | ||
id: string; | ||
type: 'ordinal' | 'boolean'; | ||
} | ||
|
||
export const isOrdinalChartData = (arg: any): arg is OrdinalChartData => { | ||
return ( | ||
typeof arg === 'object' && | ||
arg.hasOwnProperty('data') && | ||
arg.hasOwnProperty('cardinality') && | ||
arg.hasOwnProperty('id') && | ||
arg.hasOwnProperty('type') && | ||
(arg.type === 'ordinal' || arg.type === 'boolean') | ||
); | ||
}; | ||
|
||
export interface UnsupportedChartData { | ||
id: string; | ||
type: 'unsupported'; | ||
} | ||
|
||
export const isUnsupportedChartData = (arg: any): arg is UnsupportedChartData => { | ||
return typeof arg === 'object' && arg.hasOwnProperty('type') && arg.type === 'unsupported'; | ||
}; | ||
|
||
export type ChartDataItem = NumericDataItem | OrdinalDataItem; | ||
export type ChartData = NumericChartData | OrdinalChartData | UnsupportedChartData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.