mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* [ML] Fixing "aggs" use in datafeeds * removing use of Record
This commit is contained in:
parent
dc7eba0351
commit
94a40fbb3d
3 changed files with 8 additions and 4 deletions
|
@ -11,6 +11,7 @@ export type DatafeedId = string;
|
|||
export interface Datafeed {
|
||||
datafeed_id: DatafeedId;
|
||||
aggregations?: Aggregation;
|
||||
aggs?: Aggregation;
|
||||
chunking_config?: ChunkingConfig;
|
||||
frequency?: string;
|
||||
indices: IndexPatternTitle[];
|
||||
|
@ -33,6 +34,7 @@ interface Aggregation {
|
|||
field: string;
|
||||
fixed_interval: string;
|
||||
};
|
||||
aggregations: Record<string, any>;
|
||||
aggregations?: { [key: string]: any };
|
||||
aggs?: { [key: string]: any };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -623,8 +623,10 @@ export class JobCreator {
|
|||
}
|
||||
|
||||
this._aggregationFields = [];
|
||||
if (this._datafeed_config.aggregations?.buckets !== undefined) {
|
||||
collectAggs(this._datafeed_config.aggregations.buckets, this._aggregationFields);
|
||||
const buckets =
|
||||
this._datafeed_config.aggregations?.buckets || this._datafeed_config.aggs?.buckets;
|
||||
if (buckets !== undefined) {
|
||||
collectAggs(buckets, this._aggregationFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ export function collectAggs(o: any, aggFields: Field[]) {
|
|||
if (o[i] !== null && typeof o[i] === 'object') {
|
||||
if (i === 'aggregations' || i === 'aggs') {
|
||||
Object.keys(o[i]).forEach(k => {
|
||||
if (k !== 'aggregations' && i !== 'aggs') {
|
||||
if (k !== 'aggregations' && k !== 'aggs') {
|
||||
aggFields.push({
|
||||
id: k,
|
||||
name: k,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue