@@ -23,13 +23,13 @@ type BucketsPath = string | Record<string, string>;
2323
2424type SourceOptions = string | string [ ] ;
2525
26- type MetricsAggregationOptions =
26+ type AggregationSourceOptions =
2727 | {
2828 field : string ;
29- missing ?: number ;
29+ missing ?: unknown ;
3030 }
3131 | {
32- script ? : Script ;
32+ script : Script ;
3333 } ;
3434
3535interface MetricsAggregationResponsePart {
@@ -56,43 +56,39 @@ type CompositeOptionsSource = Record<
5656
5757export interface AggregationOptionsByType {
5858 terms : {
59- field : string ;
6059 size ?: number ;
61- missing ?: string ;
6260 order ?: SortOptions ;
6361 execution_hint ?: 'map' | 'global_ordinals' ;
64- } ;
62+ } & AggregationSourceOptions ;
6563 date_histogram : {
66- field : string ;
6764 format ?: string ;
6865 min_doc_count ?: number ;
6966 extended_bounds ?: {
7067 min : number ;
7168 max : number ;
7269 } ;
73- } & ( { calendar_interval : string } | { fixed_interval : string } ) ;
70+ } & ( { calendar_interval : string } | { fixed_interval : string } ) &
71+ AggregationSourceOptions ;
7472 histogram : {
75- field : string ;
7673 interval : number ;
7774 min_doc_count ?: number ;
7875 extended_bounds ?: {
7976 min ?: number | string ;
8077 max ?: number | string ;
8178 } ;
82- } ;
83- avg : MetricsAggregationOptions ;
84- max : MetricsAggregationOptions ;
85- min : MetricsAggregationOptions ;
86- sum : MetricsAggregationOptions ;
87- value_count : MetricsAggregationOptions ;
88- cardinality : MetricsAggregationOptions & {
79+ } & AggregationSourceOptions ;
80+ avg : AggregationSourceOptions ;
81+ max : AggregationSourceOptions ;
82+ min : AggregationSourceOptions ;
83+ sum : AggregationSourceOptions ;
84+ value_count : AggregationSourceOptions ;
85+ cardinality : AggregationSourceOptions & {
8986 precision_threshold ?: number ;
9087 } ;
9188 percentiles : {
92- field : string ;
9389 percents ?: number [ ] ;
9490 hdr ?: { number_of_significant_value_digits : number } ;
95- } ;
91+ } & AggregationSourceOptions ;
9692 extended_stats : {
9793 field : string ;
9894 } ;
@@ -133,25 +129,22 @@ export interface AggregationOptionsByType {
133129 reduce_script : Script ;
134130 } ;
135131 date_range : {
136- field : string ;
137132 format ?: string ;
138133 ranges : Array <
139134 | { from : string | number }
140135 | { to : string | number }
141136 | { from : string | number ; to : string | number }
142137 > ;
143138 keyed ?: boolean ;
144- } ;
139+ } & AggregationSourceOptions ;
145140 auto_date_histogram : {
146- field : string ;
147141 buckets : number ;
148- } ;
142+ } & AggregationSourceOptions ;
149143 percentile_ranks : {
150- field : string ;
151144 values : string [ ] ;
152145 keyed ?: boolean ;
153146 hdr ?: { number_of_significant_value_digits : number } ;
154- } ;
147+ } & AggregationSourceOptions ;
155148}
156149
157150type AggregationType = keyof AggregationOptionsByType ;
0 commit comments