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

[APM] Update aggregations to support script sources #76429

Merged
Changes from 2 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
22 changes: 8 additions & 14 deletions x-pack/plugins/apm/typings/elasticsearch/aggregations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,28 @@ type CompositeOptionsSource = Record<

export interface AggregationOptionsByType {
terms: {
field: string;
size?: number;
missing?: string;
order?: SortOptions;
execution_hint?: 'map' | 'global_ordinals';
};
} & MetricsAggregationOptions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we rename this then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

date_histogram: {
field: string;
format?: string;
min_doc_count?: number;
extended_bounds?: {
min: number;
max: number;
};
} & ({ calendar_interval: string } | { fixed_interval: string });
} & ({ calendar_interval: string } | { fixed_interval: string }) &
MetricsAggregationOptions;
histogram: {
field: string;
interval: number;
min_doc_count?: number;
extended_bounds?: {
min?: number | string;
max?: number | string;
};
};
} & MetricsAggregationOptions;
avg: MetricsAggregationOptions;
max: MetricsAggregationOptions;
min: MetricsAggregationOptions;
Expand All @@ -89,10 +87,9 @@ export interface AggregationOptionsByType {
precision_threshold?: number;
};
percentiles: {
field: string;
percents?: number[];
hdr?: { number_of_significant_value_digits: number };
};
} & MetricsAggregationOptions;
extended_stats: {
field: string;
};
Expand Down Expand Up @@ -133,25 +130,22 @@ export interface AggregationOptionsByType {
reduce_script: Script;
};
date_range: {
field: string;
format?: string;
ranges: Array<
| { from: string | number }
| { to: string | number }
| { from: string | number; to: string | number }
>;
keyed?: boolean;
};
} & MetricsAggregationOptions;
auto_date_histogram: {
field: string;
buckets: number;
};
} & MetricsAggregationOptions;
percentile_ranks: {
field: string;
values: string[];
keyed?: boolean;
hdr?: { number_of_significant_value_digits: number };
};
} & MetricsAggregationOptions;
}

type AggregationType = keyof AggregationOptionsByType;
Expand Down