@ahoo-wang/wow-client 10.0.0-alpha.7 → 10.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/README.zh-CN.md +4 -3
- package/dist/commands.cjs +1 -1
- package/dist/commands.cjs.map +1 -1
- package/dist/commands.d.cts +9 -13
- package/dist/commands.d.ts +9 -13
- package/dist/commands.es.js +60 -54
- package/dist/commands.es.js.map +1 -1
- package/dist/dsl/aggregation/admit.cjs +1 -1
- package/dist/dsl/aggregation/admit.cjs.map +1 -1
- package/dist/dsl/aggregation/admit.es.js +73 -69
- package/dist/dsl/aggregation/admit.es.js.map +1 -1
- package/dist/dsl/aggregation/aliases.cjs +2 -0
- package/dist/dsl/aggregation/aliases.cjs.map +1 -0
- package/dist/dsl/aggregation/aliases.d.cts +2 -0
- package/dist/dsl/aggregation/aliases.d.ts +2 -0
- package/dist/dsl/aggregation/aliases.es.js +13 -0
- package/dist/dsl/aggregation/aliases.es.js.map +1 -0
- package/dist/dsl/aggregation/builders.cjs +1 -1
- package/dist/dsl/aggregation/builders.cjs.map +1 -1
- package/dist/dsl/aggregation/builders.d.cts +17 -243
- package/dist/dsl/aggregation/builders.d.ts +17 -243
- package/dist/dsl/aggregation/builders.es.js +36 -171
- package/dist/dsl/aggregation/builders.es.js.map +1 -1
- package/dist/dsl/aggregation/derived.cjs +1 -1
- package/dist/dsl/aggregation/derived.cjs.map +1 -1
- package/dist/dsl/aggregation/derived.d.cts +123 -1
- package/dist/dsl/aggregation/derived.d.ts +123 -1
- package/dist/dsl/aggregation/derived.es.js +43 -28
- package/dist/dsl/aggregation/derived.es.js.map +1 -1
- package/dist/dsl/aggregation/groups.cjs +2 -0
- package/dist/dsl/aggregation/groups.cjs.map +1 -0
- package/dist/dsl/aggregation/groups.d.cts +325 -0
- package/dist/dsl/aggregation/groups.d.ts +325 -0
- package/dist/dsl/aggregation/groups.es.js +80 -0
- package/dist/dsl/aggregation/groups.es.js.map +1 -0
- package/dist/dsl/aggregation/having.cjs +1 -1
- package/dist/dsl/aggregation/having.cjs.map +1 -1
- package/dist/dsl/aggregation/having.d.cts +63 -1
- package/dist/dsl/aggregation/having.d.ts +63 -1
- package/dist/dsl/aggregation/having.es.js +33 -30
- package/dist/dsl/aggregation/having.es.js.map +1 -1
- package/dist/dsl/aggregation/index.d.cts +4 -2
- package/dist/dsl/aggregation/index.d.ts +4 -2
- package/dist/dsl/aggregation/metrics.cjs +2 -0
- package/dist/dsl/aggregation/metrics.cjs.map +1 -0
- package/dist/dsl/aggregation/metrics.d.cts +279 -0
- package/dist/dsl/aggregation/metrics.d.ts +279 -0
- package/dist/dsl/aggregation/metrics.es.js +75 -0
- package/dist/dsl/aggregation/metrics.es.js.map +1 -0
- package/dist/dsl/aggregation/types.cjs +1 -1
- package/dist/dsl/aggregation/types.cjs.map +1 -1
- package/dist/dsl/aggregation/types.d.cts +4 -524
- package/dist/dsl/aggregation/types.d.ts +4 -524
- package/dist/dsl/aggregation/types.es.js +5 -25
- package/dist/dsl/aggregation/types.es.js.map +1 -1
- package/dist/dsl/cursorQuery.cjs +1 -1
- package/dist/dsl/cursorQuery.cjs.map +1 -1
- package/dist/dsl/cursorQuery.d.cts +18 -7
- package/dist/dsl/cursorQuery.d.ts +18 -7
- package/dist/dsl/cursorQuery.es.js +13 -12
- package/dist/dsl/cursorQuery.es.js.map +1 -1
- package/dist/dsl/descriptor.cjs +1 -1
- package/dist/dsl/descriptor.cjs.map +1 -1
- package/dist/dsl/descriptor.d.cts +24 -379
- package/dist/dsl/descriptor.d.ts +24 -379
- package/dist/dsl/descriptor.es.js +6 -32
- package/dist/dsl/descriptor.es.js.map +1 -1
- package/dist/dsl/fieldDescriptor.cjs +2 -0
- package/dist/dsl/fieldDescriptor.cjs.map +1 -0
- package/dist/dsl/fieldDescriptor.d.cts +246 -0
- package/dist/dsl/fieldDescriptor.d.ts +246 -0
- package/dist/dsl/fieldDescriptor.es.js +24 -0
- package/dist/dsl/fieldDescriptor.es.js.map +1 -0
- package/dist/dsl/filter/builders.cjs +1 -1
- package/dist/dsl/filter/builders.cjs.map +1 -1
- package/dist/dsl/filter/builders.d.cts +7 -949
- package/dist/dsl/filter/builders.d.ts +7 -949
- package/dist/dsl/filter/builders.es.js +14 -285
- package/dist/dsl/filter/builders.es.js.map +1 -1
- package/dist/dsl/filter/expressionFilter.cjs +2 -0
- package/dist/dsl/filter/expressionFilter.cjs.map +1 -0
- package/dist/dsl/filter/expressionFilter.d.cts +35 -0
- package/dist/dsl/filter/expressionFilter.d.ts +35 -0
- package/dist/dsl/filter/expressionFilter.es.js +18 -0
- package/dist/dsl/filter/expressionFilter.es.js.map +1 -0
- package/dist/dsl/filter/fieldFilters.cjs +2 -0
- package/dist/dsl/filter/fieldFilters.cjs.map +1 -0
- package/dist/dsl/filter/fieldFilters.d.cts +297 -0
- package/dist/dsl/filter/fieldFilters.d.ts +297 -0
- package/dist/dsl/filter/fieldFilters.es.js +110 -0
- package/dist/dsl/filter/fieldFilters.es.js.map +1 -0
- package/dist/dsl/filter/index.d.cts +2 -1
- package/dist/dsl/filter/index.d.ts +2 -1
- package/dist/dsl/filter/logicalFilters.cjs +2 -0
- package/dist/dsl/filter/logicalFilters.cjs.map +1 -0
- package/dist/dsl/filter/logicalFilters.d.cts +109 -0
- package/dist/dsl/filter/logicalFilters.d.ts +109 -0
- package/dist/dsl/filter/logicalFilters.es.js +36 -0
- package/dist/dsl/filter/logicalFilters.es.js.map +1 -0
- package/dist/dsl/filter/metadataFilters.cjs +2 -0
- package/dist/dsl/filter/metadataFilters.cjs.map +1 -0
- package/dist/dsl/filter/metadataFilters.d.cts +132 -0
- package/dist/dsl/filter/metadataFilters.d.ts +132 -0
- package/dist/dsl/filter/metadataFilters.es.js +56 -0
- package/dist/dsl/filter/metadataFilters.es.js.map +1 -0
- package/dist/dsl/filter/operator.cjs +1 -1
- package/dist/dsl/filter/operator.cjs.map +1 -1
- package/dist/dsl/filter/operator.d.cts +11 -9
- package/dist/dsl/filter/operator.d.ts +11 -9
- package/dist/dsl/filter/operator.es.js +1 -1
- package/dist/dsl/filter/operator.es.js.map +1 -1
- package/dist/dsl/filter/searchFilter.cjs +2 -0
- package/dist/dsl/filter/searchFilter.cjs.map +1 -0
- package/dist/dsl/filter/searchFilter.d.cts +39 -0
- package/dist/dsl/filter/searchFilter.d.ts +39 -0
- package/dist/dsl/filter/searchFilter.es.js +19 -0
- package/dist/dsl/filter/searchFilter.es.js.map +1 -0
- package/dist/dsl/filter/timeFilters.cjs +2 -0
- package/dist/dsl/filter/timeFilters.cjs.map +1 -0
- package/dist/dsl/filter/timeFilters.d.cts +290 -0
- package/dist/dsl/filter/timeFilters.d.ts +290 -0
- package/dist/dsl/filter/timeFilters.es.js +89 -0
- package/dist/dsl/filter/timeFilters.es.js.map +1 -0
- package/dist/dsl/filter/types.d.cts +4 -14
- package/dist/dsl/filter/types.d.ts +4 -14
- package/dist/dsl/filter/validate.cjs +1 -1
- package/dist/dsl/filter/validate.cjs.map +1 -1
- package/dist/dsl/filter/validate.d.cts +2 -4
- package/dist/dsl/filter/validate.d.ts +2 -4
- package/dist/dsl/filter/validate.es.js +25 -31
- package/dist/dsl/filter/validate.es.js.map +1 -1
- package/dist/dsl/queryErrorCodes.cjs +1 -1
- package/dist/dsl/queryErrorCodes.cjs.map +1 -1
- package/dist/dsl/queryErrorCodes.d.cts +0 -2
- package/dist/dsl/queryErrorCodes.d.ts +0 -2
- package/dist/dsl/queryErrorCodes.es.js +0 -1
- package/dist/dsl/queryErrorCodes.es.js.map +1 -1
- package/dist/dsl/queryFilter.cjs +2 -0
- package/dist/dsl/queryFilter.cjs.map +1 -0
- package/dist/dsl/queryFilter.d.cts +3 -0
- package/dist/dsl/queryFilter.d.ts +3 -0
- package/dist/dsl/queryFilter.es.js +9 -0
- package/dist/dsl/queryFilter.es.js.map +1 -0
- package/dist/dsl/queryable.cjs +1 -1
- package/dist/dsl/queryable.cjs.map +1 -1
- package/dist/dsl/queryable.es.js +12 -16
- package/dist/dsl/queryable.es.js.map +1 -1
- package/dist/dsl/semanticTypes.cjs +2 -0
- package/dist/dsl/semanticTypes.cjs.map +1 -0
- package/dist/dsl/semanticTypes.d.cts +128 -0
- package/dist/dsl/semanticTypes.d.ts +128 -0
- package/dist/dsl/semanticTypes.es.js +13 -0
- package/dist/dsl/semanticTypes.es.js.map +1 -0
- package/dist/dsl.cjs +1 -1
- package/dist/dsl.d.cts +2 -0
- package/dist/dsl.d.ts +2 -0
- package/dist/dsl.es.js +14 -8
- package/dist/exactJson.cjs +2 -2
- package/dist/exactJson.cjs.map +1 -1
- package/dist/exactJson.d.cts +41 -16
- package/dist/exactJson.d.ts +41 -16
- package/dist/exactJson.es.js +104 -102
- package/dist/exactJson.es.js.map +1 -1
- package/dist/frameworkErrors.cjs.map +1 -1
- package/dist/frameworkErrors.d.cts +5 -5
- package/dist/frameworkErrors.d.ts +5 -5
- package/dist/frameworkErrors.es.js.map +1 -1
- package/dist/http.cjs +1 -1
- package/dist/http.cjs.map +1 -1
- package/dist/http.d.cts +29 -9
- package/dist/http.d.ts +29 -9
- package/dist/http.es.js +24 -19
- package/dist/http.es.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +12 -12
- package/dist/manifest.cjs +1 -1
- package/dist/manifest.cjs.map +1 -1
- package/dist/manifest.d.cts +30 -2
- package/dist/manifest.d.ts +30 -2
- package/dist/manifest.es.js +34 -6
- package/dist/manifest.es.js.map +1 -1
- package/dist/manifestTypes.d.cts +21 -4
- package/dist/manifestTypes.d.ts +21 -4
- package/dist/queries.cjs +1 -1
- package/dist/queries.cjs.map +1 -1
- package/dist/queries.d.cts +18 -8
- package/dist/queries.d.ts +18 -8
- package/dist/queries.es.js +46 -35
- package/dist/queries.es.js.map +1 -1
- package/dist/routes.cjs +1 -1
- package/dist/routes.cjs.map +1 -1
- package/dist/routes.d.cts +16 -3
- package/dist/routes.d.ts +16 -3
- package/dist/routes.es.js +24 -25
- package/dist/routes.es.js.map +1 -1
- package/dist/state.cjs +1 -1
- package/dist/state.cjs.map +1 -1
- package/dist/state.d.cts +21 -19
- package/dist/state.d.ts +21 -19
- package/dist/state.es.js +27 -22
- package/dist/state.es.js.map +1 -1
- package/dist/streams.cjs +1 -1
- package/dist/streams.cjs.map +1 -1
- package/dist/streams.d.cts +14 -7
- package/dist/streams.d.ts +14 -7
- package/dist/streams.es.js +65 -50
- package/dist/streams.es.js.map +1 -1
- package/dist/testing/wire.cjs +1 -1
- package/dist/testing/wire.cjs.map +1 -1
- package/dist/testing/wire.es.js +1 -1
- package/dist/testing/wire.es.js.map +1 -1
- package/dist/wait.cjs +1 -1
- package/dist/wait.cjs.map +1 -1
- package/dist/wait.d.cts +18 -5
- package/dist/wait.d.ts +18 -5
- package/dist/wait.es.js +36 -34
- package/dist/wait.es.js.map +1 -1
- package/dist/wire.cjs +1 -1
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +76 -31
- package/dist/wire.d.ts +76 -31
- package/dist/wire.es.js +1 -3
- package/dist/wire.es.js.map +1 -1
- package/package.json +5 -5
- package/dist/dsl/filter/datePattern.cjs +0 -2
- package/dist/dsl/filter/datePattern.cjs.map +0 -1
- package/dist/dsl/filter/datePattern.d.cts +0 -8
- package/dist/dsl/filter/datePattern.d.ts +0 -8
- package/dist/dsl/filter/datePattern.es.js +0 -96
- package/dist/dsl/filter/datePattern.es.js.map +0 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { QueryField } from '../filter/index.cjs';
|
|
2
|
+
import { AggregationExpression } from './types.cjs';
|
|
3
|
+
/** The kind of an {@link AggregationGroup}, sent as its `type`. */
|
|
4
|
+
export declare enum AggregationGroupType {
|
|
5
|
+
/** One group per distinct value; {@link groupBuilders.terms | `aggregation.terms`}. */
|
|
6
|
+
TERMS = "terms",
|
|
7
|
+
/** Number buckets of equal width; {@link groupBuilders.histogram | `aggregation.histogram`}. */
|
|
8
|
+
HISTOGRAM = "histogram",
|
|
9
|
+
/** Calendar buckets of a time field; {@link groupBuilders.dateHistogram | `aggregation.dateHistogram`}. */
|
|
10
|
+
DATE_HISTOGRAM = "date-histogram",
|
|
11
|
+
/**
|
|
12
|
+
* One calendar part of a time field, such as the weekday or the hour;
|
|
13
|
+
* {@link groupBuilders.datePart | `aggregation.datePart`}. Wow 9.2 and later.
|
|
14
|
+
*/
|
|
15
|
+
DATE_PART = "date-part"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* What an {@link AggregationGroup}'s field is relative to when the query
|
|
19
|
+
* expands elements, sent as its `scope`. Wow 9.9 and later.
|
|
20
|
+
*/
|
|
21
|
+
export declare enum AggregationGroupScope {
|
|
22
|
+
/** The innermost expanded element; the default. */
|
|
23
|
+
ELEMENT = "element",
|
|
24
|
+
/** The root record, so the elements are grouped by a field of their root. */
|
|
25
|
+
ROOT = "root"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The calendar unit of a `DATE_HISTOGRAM` bucket, cut in the group's
|
|
29
|
+
* `timeZone`.
|
|
30
|
+
*/
|
|
31
|
+
export declare enum AggregationDateUnit {
|
|
32
|
+
YEAR = "year",
|
|
33
|
+
QUARTER = "quarter",
|
|
34
|
+
MONTH = "month",
|
|
35
|
+
WEEK = "week",
|
|
36
|
+
DAY = "day",
|
|
37
|
+
HOUR = "hour",
|
|
38
|
+
MINUTE = "minute",
|
|
39
|
+
SECOND = "second"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The calendar part a `DATE_PART` group takes of each instant, read in the
|
|
43
|
+
* group's `timeZone`. Its keys are integers from a fixed domain, so records
|
|
44
|
+
* from different days, weeks or years fall into one bucket.
|
|
45
|
+
*/
|
|
46
|
+
export declare enum AggregationDatePart {
|
|
47
|
+
/** The ISO weekday: 1 is Monday, 7 is Sunday. */
|
|
48
|
+
DAY_OF_WEEK = "day-of-week",
|
|
49
|
+
/**
|
|
50
|
+
* The day of the month, 1 to 31; days 29 to 31 exist only in the months
|
|
51
|
+
* that have them.
|
|
52
|
+
*/
|
|
53
|
+
DAY_OF_MONTH = "day-of-month",
|
|
54
|
+
/** The hour on the wall clock of the group's `timeZone`, 0 to 23. */
|
|
55
|
+
HOUR_OF_DAY = "hour-of-day",
|
|
56
|
+
/** The month of the year, 1 (January) to 12. */
|
|
57
|
+
MONTH_OF_YEAR = "month-of-year"
|
|
58
|
+
}
|
|
59
|
+
/** What every {@link AggregationGroup} has. */
|
|
60
|
+
interface AggregationGroupBase<FIELDS extends string = string> {
|
|
61
|
+
/** The field the rows are grouped by. */
|
|
62
|
+
field: QueryField<FIELDS>;
|
|
63
|
+
/** The name of the group's column in the result rows. */
|
|
64
|
+
alias: string;
|
|
65
|
+
/**
|
|
66
|
+
* What `field` is relative to when the query expands elements: the
|
|
67
|
+
* innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
|
|
68
|
+
* A `ROOT` group names a field, never an expression. Wow 9.9 and later,
|
|
69
|
+
* where `analysis.rootGroups` is `true`.
|
|
70
|
+
*/
|
|
71
|
+
scope?: AggregationGroupScope;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What a TERMS or HISTOGRAM group groups by: a field, or a computed
|
|
75
|
+
* expression in its place (Wow 9.2 and later), never both. An expression
|
|
76
|
+
* input is an expensive computation the server admits only where
|
|
77
|
+
* `analysis.expressions` is `true`.
|
|
78
|
+
*/
|
|
79
|
+
export type AggregationGroupInput<FIELDS extends string = string> = {
|
|
80
|
+
/** The field the rows are grouped by. */
|
|
81
|
+
field: QueryField<FIELDS>;
|
|
82
|
+
expression?: undefined;
|
|
83
|
+
} | {
|
|
84
|
+
field?: undefined;
|
|
85
|
+
/** The per-row value the rows are grouped by, such as a `DATE_DIFF`. */
|
|
86
|
+
expression: AggregationExpression<FIELDS>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* One group per distinct value of a field, or of an expression;
|
|
90
|
+
* {@link groupBuilders.terms | `aggregation.terms`}. `missingKey` needs a field.
|
|
91
|
+
*/
|
|
92
|
+
export type TermsAggregationGroup<FIELDS extends string = string> = {
|
|
93
|
+
type: AggregationGroupType.TERMS;
|
|
94
|
+
/** The name of the group's column in the result rows. */
|
|
95
|
+
alias: string;
|
|
96
|
+
/** The key the rows without a value are grouped under. Wow 9.1 and later. */
|
|
97
|
+
missingKey?: string;
|
|
98
|
+
/**
|
|
99
|
+
* What `field` is relative to when the query expands elements: the
|
|
100
|
+
* innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
|
|
101
|
+
* A `ROOT` group names a field, never an expression. Wow 9.9 and later,
|
|
102
|
+
* where `analysis.rootGroups` is `true`.
|
|
103
|
+
*/
|
|
104
|
+
scope?: AggregationGroupScope;
|
|
105
|
+
} & AggregationGroupInput<FIELDS>;
|
|
106
|
+
/**
|
|
107
|
+
* Buckets of equal width over a number field, or over an expression;
|
|
108
|
+
* {@link groupBuilders.histogram | `aggregation.histogram`}.
|
|
109
|
+
*/
|
|
110
|
+
export type HistogramAggregationGroup<FIELDS extends string = string> = {
|
|
111
|
+
type: AggregationGroupType.HISTOGRAM;
|
|
112
|
+
/** The name of the group's column in the result rows. */
|
|
113
|
+
alias: string;
|
|
114
|
+
/** The width of each bucket, greater than 0. */
|
|
115
|
+
interval: number;
|
|
116
|
+
/**
|
|
117
|
+
* What `field` is relative to when the query expands elements: the
|
|
118
|
+
* innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
|
|
119
|
+
* A `ROOT` group names a field, never an expression. Wow 9.9 and later,
|
|
120
|
+
* where `analysis.rootGroups` is `true`.
|
|
121
|
+
*/
|
|
122
|
+
scope?: AggregationGroupScope;
|
|
123
|
+
} & AggregationGroupInput<FIELDS>;
|
|
124
|
+
/**
|
|
125
|
+
* Calendar buckets over a time field in epoch milliseconds;
|
|
126
|
+
* {@link groupBuilders.dateHistogram | `aggregation.dateHistogram`}.
|
|
127
|
+
*/
|
|
128
|
+
export interface DateHistogramAggregationGroup<FIELDS extends string = string> extends AggregationGroupBase<FIELDS> {
|
|
129
|
+
type: AggregationGroupType.DATE_HISTOGRAM;
|
|
130
|
+
/** The calendar unit of each bucket. */
|
|
131
|
+
unit: AggregationDateUnit;
|
|
132
|
+
/** The IANA zone the buckets are cut in; `UTC` when absent. */
|
|
133
|
+
timeZone?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the server fills in the empty buckets of the range. Wow 9.1 and
|
|
136
|
+
* later, and only when this is the query's only group.
|
|
137
|
+
*/
|
|
138
|
+
dense?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* One calendar part of a time field in epoch milliseconds, such as the
|
|
142
|
+
* weekday or the hour; {@link groupBuilders.datePart | `aggregation.datePart`}. Its keys in the result
|
|
143
|
+
* rows are integers from the part's domain, such as 1 (Monday) to 7 (Sunday)
|
|
144
|
+
* for `DAY_OF_WEEK`. Wow 9.2 and later.
|
|
145
|
+
*/
|
|
146
|
+
export interface DatePartAggregationGroup<FIELDS extends string = string> extends AggregationGroupBase<FIELDS> {
|
|
147
|
+
type: AggregationGroupType.DATE_PART;
|
|
148
|
+
/** The calendar part each row is grouped by. */
|
|
149
|
+
part: AggregationDatePart;
|
|
150
|
+
/** The IANA zone the part is read in; `UTC` when absent. */
|
|
151
|
+
timeZone?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Whether the server returns every key of the part's domain, filling a
|
|
154
|
+
* key with no records with each metric's empty value. Only when this is
|
|
155
|
+
* the query's only group.
|
|
156
|
+
*/
|
|
157
|
+
dense?: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* One dimension of an {@link AggregationQuery}'s `groupBy`: each result row
|
|
161
|
+
* is one combination of the groups' keys.
|
|
162
|
+
*/
|
|
163
|
+
export type AggregationGroup<FIELDS extends string = string> = TermsAggregationGroup<FIELDS> | HistogramAggregationGroup<FIELDS> | DateHistogramAggregationGroup<FIELDS> | DatePartAggregationGroup<FIELDS>;
|
|
164
|
+
/** The option every group builder takes. */
|
|
165
|
+
export interface AggregationGroupScopeOptions {
|
|
166
|
+
/**
|
|
167
|
+
* What the field is relative to when the query expands elements; the
|
|
168
|
+
* innermost element when absent. `ROOT` needs a field input. Wow 9.9 and
|
|
169
|
+
* later.
|
|
170
|
+
*/
|
|
171
|
+
scope?: AggregationGroupScope;
|
|
172
|
+
}
|
|
173
|
+
/** The options of {@link groupBuilders.terms | `aggregation.terms`}. */
|
|
174
|
+
export interface TermsAggregationOptions extends AggregationGroupScopeOptions {
|
|
175
|
+
/** The key rows without a value are grouped under; must not be blank. */
|
|
176
|
+
missingKey?: string;
|
|
177
|
+
}
|
|
178
|
+
/** The options of {@link groupBuilders.histogram | `aggregation.histogram`}. */
|
|
179
|
+
export interface HistogramAggregationOptions extends AggregationGroupScopeOptions {
|
|
180
|
+
/** The width of each bucket: finite and greater than 0. */
|
|
181
|
+
interval: number;
|
|
182
|
+
}
|
|
183
|
+
/** The options of {@link groupBuilders.dateHistogram | `aggregation.dateHistogram`}. */
|
|
184
|
+
export interface DateHistogramAggregationOptions extends AggregationGroupScopeOptions {
|
|
185
|
+
/** The calendar unit of each bucket. */
|
|
186
|
+
unit: AggregationDateUnit;
|
|
187
|
+
/** The zone the buckets are cut in, an IANA id. Sent only when set; the server reads none as `UTC`. */
|
|
188
|
+
timeZone?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Whether the server fills in the empty buckets of the range. Only when
|
|
191
|
+
* this is the only group.
|
|
192
|
+
*/
|
|
193
|
+
dense?: boolean;
|
|
194
|
+
}
|
|
195
|
+
/** The options of {@link groupBuilders.datePart | `aggregation.datePart`}. */
|
|
196
|
+
export interface DatePartAggregationOptions extends AggregationGroupScopeOptions {
|
|
197
|
+
/** The calendar part each row is grouped by. */
|
|
198
|
+
part: AggregationDatePart;
|
|
199
|
+
/** The zone the part is read in, an IANA id. Sent only when set; the server reads none as `UTC`. */
|
|
200
|
+
timeZone?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Whether the server returns every key of the part's domain, the empty
|
|
203
|
+
* ones filled in. Only when this is the only group.
|
|
204
|
+
*/
|
|
205
|
+
dense?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The input of a TERMS or HISTOGRAM group: a field path, or an expression in
|
|
209
|
+
* its place, never both, as Wow's `requireGroupInput` has it.
|
|
210
|
+
*/
|
|
211
|
+
export declare function groupInput<FIELDS extends string>(input: FIELDS | AggregationExpression<FIELDS>, type: string): AggregationGroupInput<FIELDS>;
|
|
212
|
+
/** A group's `scope`, sent only when given; `ROOT` needs a field input. */
|
|
213
|
+
export declare function groupScope(scope: AggregationGroupScope | undefined, type: string, source: {
|
|
214
|
+
expression?: unknown;
|
|
215
|
+
}): {
|
|
216
|
+
scope?: AggregationGroupScope;
|
|
217
|
+
};
|
|
218
|
+
/** The builders of the groups of an aggregation query: terms, histograms, date histograms and date parts. */
|
|
219
|
+
export declare const groupBuilders: {
|
|
220
|
+
/**
|
|
221
|
+
* Groups by each distinct value of a field, or of a computed expression.
|
|
222
|
+
* `{ type: 'terms', field, alias, missingKey? }`, or
|
|
223
|
+
* `{ type: 'terms', expression, alias }`.
|
|
224
|
+
*
|
|
225
|
+
* @param input - The field to group by, or an expression in its place
|
|
226
|
+
* (Wow 9.2 and later, an expensive computation).
|
|
227
|
+
* @param alias - The name of the group column in the result rows.
|
|
228
|
+
* @param options.missingKey - The key of the rows without a value; only
|
|
229
|
+
* with a field.
|
|
230
|
+
* @param options.scope - What the field is relative to when the query
|
|
231
|
+
* expands elements: `ROOT` groups the elements by a field of their root
|
|
232
|
+
* record. Wow 9.9 and later.
|
|
233
|
+
* @throws TypeError when `input` or `alias` is invalid, `missingKey` is
|
|
234
|
+
* blank, or `missingKey` is given with an expression.
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* aggregation.terms('state.status', 'status', { missingKey: 'NONE' });
|
|
238
|
+
* aggregation.terms(
|
|
239
|
+
* aggregation.dateDiff('state.paidAt', 'state.shippedAt', DateDiffUnit.DAY),
|
|
240
|
+
* 'daysToShip',
|
|
241
|
+
* );
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
terms<FIELDS extends string>(input: FIELDS | AggregationExpression<FIELDS>, alias: string, { missingKey, scope }?: TermsAggregationOptions): TermsAggregationGroup<FIELDS>;
|
|
245
|
+
/**
|
|
246
|
+
* Groups a number field, or a computed expression, into buckets of equal
|
|
247
|
+
* width. `{ type: 'histogram', field | expression, interval, alias }`.
|
|
248
|
+
*
|
|
249
|
+
* @param input - The number field to bucket, or an expression in its
|
|
250
|
+
* place (Wow 9.2 and later, an expensive computation).
|
|
251
|
+
* @param alias - The name of the bucket column in the result rows.
|
|
252
|
+
* @param options.interval - The bucket width.
|
|
253
|
+
* @param options.scope - What the field is relative to when the query
|
|
254
|
+
* expands elements: `ROOT` groups the elements by a field of their root
|
|
255
|
+
* record. Wow 9.9 and later.
|
|
256
|
+
* @throws TypeError when `interval` is not finite and greater than 0, or
|
|
257
|
+
* `field` or `alias` is invalid.
|
|
258
|
+
* @example
|
|
259
|
+
* ```typescript
|
|
260
|
+
* aggregation.histogram('state.amount', 'amountBand', { interval: 100 });
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
histogram<FIELDS extends string>(input: FIELDS | AggregationExpression<FIELDS>, alias: string, { interval, scope }: HistogramAggregationOptions): HistogramAggregationGroup<FIELDS>;
|
|
264
|
+
/**
|
|
265
|
+
* Groups a time field into calendar buckets.
|
|
266
|
+
* `{ type: 'date-histogram', field, unit, alias, timeZone?, dense? }`.
|
|
267
|
+
*
|
|
268
|
+
* @param field - The time field (epoch milliseconds) to bucket.
|
|
269
|
+
* @param alias - The name of the bucket column in the result rows.
|
|
270
|
+
* @param options.unit - The calendar unit of a bucket.
|
|
271
|
+
* @param options.timeZone - The zone buckets are cut in. Sent only when
|
|
272
|
+
* set; the server reads none as `UTC`.
|
|
273
|
+
* @param options.dense - Whether the empty buckets of the range are filled
|
|
274
|
+
* in.
|
|
275
|
+
* @param options.scope - What the field is relative to when the query
|
|
276
|
+
* expands elements: `ROOT` groups the elements by a field of their root
|
|
277
|
+
* record. Wow 9.9 and later.
|
|
278
|
+
* @throws TypeError when `unit` is not an `AggregationDateUnit`,
|
|
279
|
+
* `timeZone` is blank, `dense` is not a boolean, or `field` or `alias` is
|
|
280
|
+
* invalid.
|
|
281
|
+
* @example
|
|
282
|
+
* ```typescript
|
|
283
|
+
* aggregation.dateHistogram('createTime', 'day', {
|
|
284
|
+
* unit: AggregationDateUnit.DAY,
|
|
285
|
+
* timeZone: 'Asia/Shanghai',
|
|
286
|
+
* });
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
dateHistogram<FIELDS extends string>(field: FIELDS, alias: string, { unit, timeZone, dense, scope }: DateHistogramAggregationOptions): DateHistogramAggregationGroup<FIELDS>;
|
|
290
|
+
/**
|
|
291
|
+
* Groups a time field by one calendar part of each instant, such as the
|
|
292
|
+
* weekday or the hour, so records from different days share a bucket.
|
|
293
|
+
* `{ type: 'date-part', field, part, alias, timeZone?, dense? }`.
|
|
294
|
+
*
|
|
295
|
+
* The group's keys in the result rows are integers: `DAY_OF_WEEK` is the
|
|
296
|
+
* ISO weekday, 1 (Monday) to 7 (Sunday); `DAY_OF_MONTH` 1 to 31;
|
|
297
|
+
* `HOUR_OF_DAY` 0 to 23 on the wall clock of `timeZone`; `MONTH_OF_YEAR`
|
|
298
|
+
* 1 to 12. With `dense`, every key of that domain comes back, those
|
|
299
|
+
* without records carrying each metric's empty value; `dense` needs the
|
|
300
|
+
* group to be the query's only one. Wow 9.2 and later.
|
|
301
|
+
*
|
|
302
|
+
* @param field - The time field (epoch milliseconds) to read the part of.
|
|
303
|
+
* @param alias - The name of the part column in the result rows.
|
|
304
|
+
* @param options.part - The calendar part to group by.
|
|
305
|
+
* @param options.timeZone - The zone the part is read in. Sent only when
|
|
306
|
+
* set; the server reads none as `UTC`.
|
|
307
|
+
* @param options.dense - Whether every key of the part's domain is
|
|
308
|
+
* returned.
|
|
309
|
+
* @param options.scope - What the field is relative to when the query
|
|
310
|
+
* expands elements: `ROOT` groups the elements by a field of their root
|
|
311
|
+
* record. Wow 9.9 and later.
|
|
312
|
+
* @throws TypeError when `part` is not an `AggregationDatePart`,
|
|
313
|
+
* `timeZone` is blank, `dense` is not a boolean, or `field` or `alias` is
|
|
314
|
+
* invalid.
|
|
315
|
+
* @example
|
|
316
|
+
* ```typescript
|
|
317
|
+
* aggregation.datePart('createTime', 'weekday', {
|
|
318
|
+
* part: AggregationDatePart.DAY_OF_WEEK,
|
|
319
|
+
* timeZone: 'Asia/Shanghai',
|
|
320
|
+
* });
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
datePart<FIELDS extends string>(field: FIELDS, alias: string, { part, timeZone, dense, scope }: DatePartAggregationOptions): DatePartAggregationGroup<FIELDS>;
|
|
324
|
+
};
|
|
325
|
+
export {};
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { QueryField } from '../filter/index.js';
|
|
2
|
+
import { AggregationExpression } from './types.js';
|
|
3
|
+
/** The kind of an {@link AggregationGroup}, sent as its `type`. */
|
|
4
|
+
export declare enum AggregationGroupType {
|
|
5
|
+
/** One group per distinct value; {@link groupBuilders.terms | `aggregation.terms`}. */
|
|
6
|
+
TERMS = "terms",
|
|
7
|
+
/** Number buckets of equal width; {@link groupBuilders.histogram | `aggregation.histogram`}. */
|
|
8
|
+
HISTOGRAM = "histogram",
|
|
9
|
+
/** Calendar buckets of a time field; {@link groupBuilders.dateHistogram | `aggregation.dateHistogram`}. */
|
|
10
|
+
DATE_HISTOGRAM = "date-histogram",
|
|
11
|
+
/**
|
|
12
|
+
* One calendar part of a time field, such as the weekday or the hour;
|
|
13
|
+
* {@link groupBuilders.datePart | `aggregation.datePart`}. Wow 9.2 and later.
|
|
14
|
+
*/
|
|
15
|
+
DATE_PART = "date-part"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* What an {@link AggregationGroup}'s field is relative to when the query
|
|
19
|
+
* expands elements, sent as its `scope`. Wow 9.9 and later.
|
|
20
|
+
*/
|
|
21
|
+
export declare enum AggregationGroupScope {
|
|
22
|
+
/** The innermost expanded element; the default. */
|
|
23
|
+
ELEMENT = "element",
|
|
24
|
+
/** The root record, so the elements are grouped by a field of their root. */
|
|
25
|
+
ROOT = "root"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The calendar unit of a `DATE_HISTOGRAM` bucket, cut in the group's
|
|
29
|
+
* `timeZone`.
|
|
30
|
+
*/
|
|
31
|
+
export declare enum AggregationDateUnit {
|
|
32
|
+
YEAR = "year",
|
|
33
|
+
QUARTER = "quarter",
|
|
34
|
+
MONTH = "month",
|
|
35
|
+
WEEK = "week",
|
|
36
|
+
DAY = "day",
|
|
37
|
+
HOUR = "hour",
|
|
38
|
+
MINUTE = "minute",
|
|
39
|
+
SECOND = "second"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The calendar part a `DATE_PART` group takes of each instant, read in the
|
|
43
|
+
* group's `timeZone`. Its keys are integers from a fixed domain, so records
|
|
44
|
+
* from different days, weeks or years fall into one bucket.
|
|
45
|
+
*/
|
|
46
|
+
export declare enum AggregationDatePart {
|
|
47
|
+
/** The ISO weekday: 1 is Monday, 7 is Sunday. */
|
|
48
|
+
DAY_OF_WEEK = "day-of-week",
|
|
49
|
+
/**
|
|
50
|
+
* The day of the month, 1 to 31; days 29 to 31 exist only in the months
|
|
51
|
+
* that have them.
|
|
52
|
+
*/
|
|
53
|
+
DAY_OF_MONTH = "day-of-month",
|
|
54
|
+
/** The hour on the wall clock of the group's `timeZone`, 0 to 23. */
|
|
55
|
+
HOUR_OF_DAY = "hour-of-day",
|
|
56
|
+
/** The month of the year, 1 (January) to 12. */
|
|
57
|
+
MONTH_OF_YEAR = "month-of-year"
|
|
58
|
+
}
|
|
59
|
+
/** What every {@link AggregationGroup} has. */
|
|
60
|
+
interface AggregationGroupBase<FIELDS extends string = string> {
|
|
61
|
+
/** The field the rows are grouped by. */
|
|
62
|
+
field: QueryField<FIELDS>;
|
|
63
|
+
/** The name of the group's column in the result rows. */
|
|
64
|
+
alias: string;
|
|
65
|
+
/**
|
|
66
|
+
* What `field` is relative to when the query expands elements: the
|
|
67
|
+
* innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
|
|
68
|
+
* A `ROOT` group names a field, never an expression. Wow 9.9 and later,
|
|
69
|
+
* where `analysis.rootGroups` is `true`.
|
|
70
|
+
*/
|
|
71
|
+
scope?: AggregationGroupScope;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What a TERMS or HISTOGRAM group groups by: a field, or a computed
|
|
75
|
+
* expression in its place (Wow 9.2 and later), never both. An expression
|
|
76
|
+
* input is an expensive computation the server admits only where
|
|
77
|
+
* `analysis.expressions` is `true`.
|
|
78
|
+
*/
|
|
79
|
+
export type AggregationGroupInput<FIELDS extends string = string> = {
|
|
80
|
+
/** The field the rows are grouped by. */
|
|
81
|
+
field: QueryField<FIELDS>;
|
|
82
|
+
expression?: undefined;
|
|
83
|
+
} | {
|
|
84
|
+
field?: undefined;
|
|
85
|
+
/** The per-row value the rows are grouped by, such as a `DATE_DIFF`. */
|
|
86
|
+
expression: AggregationExpression<FIELDS>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* One group per distinct value of a field, or of an expression;
|
|
90
|
+
* {@link groupBuilders.terms | `aggregation.terms`}. `missingKey` needs a field.
|
|
91
|
+
*/
|
|
92
|
+
export type TermsAggregationGroup<FIELDS extends string = string> = {
|
|
93
|
+
type: AggregationGroupType.TERMS;
|
|
94
|
+
/** The name of the group's column in the result rows. */
|
|
95
|
+
alias: string;
|
|
96
|
+
/** The key the rows without a value are grouped under. Wow 9.1 and later. */
|
|
97
|
+
missingKey?: string;
|
|
98
|
+
/**
|
|
99
|
+
* What `field` is relative to when the query expands elements: the
|
|
100
|
+
* innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
|
|
101
|
+
* A `ROOT` group names a field, never an expression. Wow 9.9 and later,
|
|
102
|
+
* where `analysis.rootGroups` is `true`.
|
|
103
|
+
*/
|
|
104
|
+
scope?: AggregationGroupScope;
|
|
105
|
+
} & AggregationGroupInput<FIELDS>;
|
|
106
|
+
/**
|
|
107
|
+
* Buckets of equal width over a number field, or over an expression;
|
|
108
|
+
* {@link groupBuilders.histogram | `aggregation.histogram`}.
|
|
109
|
+
*/
|
|
110
|
+
export type HistogramAggregationGroup<FIELDS extends string = string> = {
|
|
111
|
+
type: AggregationGroupType.HISTOGRAM;
|
|
112
|
+
/** The name of the group's column in the result rows. */
|
|
113
|
+
alias: string;
|
|
114
|
+
/** The width of each bucket, greater than 0. */
|
|
115
|
+
interval: number;
|
|
116
|
+
/**
|
|
117
|
+
* What `field` is relative to when the query expands elements: the
|
|
118
|
+
* innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
|
|
119
|
+
* A `ROOT` group names a field, never an expression. Wow 9.9 and later,
|
|
120
|
+
* where `analysis.rootGroups` is `true`.
|
|
121
|
+
*/
|
|
122
|
+
scope?: AggregationGroupScope;
|
|
123
|
+
} & AggregationGroupInput<FIELDS>;
|
|
124
|
+
/**
|
|
125
|
+
* Calendar buckets over a time field in epoch milliseconds;
|
|
126
|
+
* {@link groupBuilders.dateHistogram | `aggregation.dateHistogram`}.
|
|
127
|
+
*/
|
|
128
|
+
export interface DateHistogramAggregationGroup<FIELDS extends string = string> extends AggregationGroupBase<FIELDS> {
|
|
129
|
+
type: AggregationGroupType.DATE_HISTOGRAM;
|
|
130
|
+
/** The calendar unit of each bucket. */
|
|
131
|
+
unit: AggregationDateUnit;
|
|
132
|
+
/** The IANA zone the buckets are cut in; `UTC` when absent. */
|
|
133
|
+
timeZone?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the server fills in the empty buckets of the range. Wow 9.1 and
|
|
136
|
+
* later, and only when this is the query's only group.
|
|
137
|
+
*/
|
|
138
|
+
dense?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* One calendar part of a time field in epoch milliseconds, such as the
|
|
142
|
+
* weekday or the hour; {@link groupBuilders.datePart | `aggregation.datePart`}. Its keys in the result
|
|
143
|
+
* rows are integers from the part's domain, such as 1 (Monday) to 7 (Sunday)
|
|
144
|
+
* for `DAY_OF_WEEK`. Wow 9.2 and later.
|
|
145
|
+
*/
|
|
146
|
+
export interface DatePartAggregationGroup<FIELDS extends string = string> extends AggregationGroupBase<FIELDS> {
|
|
147
|
+
type: AggregationGroupType.DATE_PART;
|
|
148
|
+
/** The calendar part each row is grouped by. */
|
|
149
|
+
part: AggregationDatePart;
|
|
150
|
+
/** The IANA zone the part is read in; `UTC` when absent. */
|
|
151
|
+
timeZone?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Whether the server returns every key of the part's domain, filling a
|
|
154
|
+
* key with no records with each metric's empty value. Only when this is
|
|
155
|
+
* the query's only group.
|
|
156
|
+
*/
|
|
157
|
+
dense?: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* One dimension of an {@link AggregationQuery}'s `groupBy`: each result row
|
|
161
|
+
* is one combination of the groups' keys.
|
|
162
|
+
*/
|
|
163
|
+
export type AggregationGroup<FIELDS extends string = string> = TermsAggregationGroup<FIELDS> | HistogramAggregationGroup<FIELDS> | DateHistogramAggregationGroup<FIELDS> | DatePartAggregationGroup<FIELDS>;
|
|
164
|
+
/** The option every group builder takes. */
|
|
165
|
+
export interface AggregationGroupScopeOptions {
|
|
166
|
+
/**
|
|
167
|
+
* What the field is relative to when the query expands elements; the
|
|
168
|
+
* innermost element when absent. `ROOT` needs a field input. Wow 9.9 and
|
|
169
|
+
* later.
|
|
170
|
+
*/
|
|
171
|
+
scope?: AggregationGroupScope;
|
|
172
|
+
}
|
|
173
|
+
/** The options of {@link groupBuilders.terms | `aggregation.terms`}. */
|
|
174
|
+
export interface TermsAggregationOptions extends AggregationGroupScopeOptions {
|
|
175
|
+
/** The key rows without a value are grouped under; must not be blank. */
|
|
176
|
+
missingKey?: string;
|
|
177
|
+
}
|
|
178
|
+
/** The options of {@link groupBuilders.histogram | `aggregation.histogram`}. */
|
|
179
|
+
export interface HistogramAggregationOptions extends AggregationGroupScopeOptions {
|
|
180
|
+
/** The width of each bucket: finite and greater than 0. */
|
|
181
|
+
interval: number;
|
|
182
|
+
}
|
|
183
|
+
/** The options of {@link groupBuilders.dateHistogram | `aggregation.dateHistogram`}. */
|
|
184
|
+
export interface DateHistogramAggregationOptions extends AggregationGroupScopeOptions {
|
|
185
|
+
/** The calendar unit of each bucket. */
|
|
186
|
+
unit: AggregationDateUnit;
|
|
187
|
+
/** The zone the buckets are cut in, an IANA id. Sent only when set; the server reads none as `UTC`. */
|
|
188
|
+
timeZone?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Whether the server fills in the empty buckets of the range. Only when
|
|
191
|
+
* this is the only group.
|
|
192
|
+
*/
|
|
193
|
+
dense?: boolean;
|
|
194
|
+
}
|
|
195
|
+
/** The options of {@link groupBuilders.datePart | `aggregation.datePart`}. */
|
|
196
|
+
export interface DatePartAggregationOptions extends AggregationGroupScopeOptions {
|
|
197
|
+
/** The calendar part each row is grouped by. */
|
|
198
|
+
part: AggregationDatePart;
|
|
199
|
+
/** The zone the part is read in, an IANA id. Sent only when set; the server reads none as `UTC`. */
|
|
200
|
+
timeZone?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Whether the server returns every key of the part's domain, the empty
|
|
203
|
+
* ones filled in. Only when this is the only group.
|
|
204
|
+
*/
|
|
205
|
+
dense?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The input of a TERMS or HISTOGRAM group: a field path, or an expression in
|
|
209
|
+
* its place, never both, as Wow's `requireGroupInput` has it.
|
|
210
|
+
*/
|
|
211
|
+
export declare function groupInput<FIELDS extends string>(input: FIELDS | AggregationExpression<FIELDS>, type: string): AggregationGroupInput<FIELDS>;
|
|
212
|
+
/** A group's `scope`, sent only when given; `ROOT` needs a field input. */
|
|
213
|
+
export declare function groupScope(scope: AggregationGroupScope | undefined, type: string, source: {
|
|
214
|
+
expression?: unknown;
|
|
215
|
+
}): {
|
|
216
|
+
scope?: AggregationGroupScope;
|
|
217
|
+
};
|
|
218
|
+
/** The builders of the groups of an aggregation query: terms, histograms, date histograms and date parts. */
|
|
219
|
+
export declare const groupBuilders: {
|
|
220
|
+
/**
|
|
221
|
+
* Groups by each distinct value of a field, or of a computed expression.
|
|
222
|
+
* `{ type: 'terms', field, alias, missingKey? }`, or
|
|
223
|
+
* `{ type: 'terms', expression, alias }`.
|
|
224
|
+
*
|
|
225
|
+
* @param input - The field to group by, or an expression in its place
|
|
226
|
+
* (Wow 9.2 and later, an expensive computation).
|
|
227
|
+
* @param alias - The name of the group column in the result rows.
|
|
228
|
+
* @param options.missingKey - The key of the rows without a value; only
|
|
229
|
+
* with a field.
|
|
230
|
+
* @param options.scope - What the field is relative to when the query
|
|
231
|
+
* expands elements: `ROOT` groups the elements by a field of their root
|
|
232
|
+
* record. Wow 9.9 and later.
|
|
233
|
+
* @throws TypeError when `input` or `alias` is invalid, `missingKey` is
|
|
234
|
+
* blank, or `missingKey` is given with an expression.
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* aggregation.terms('state.status', 'status', { missingKey: 'NONE' });
|
|
238
|
+
* aggregation.terms(
|
|
239
|
+
* aggregation.dateDiff('state.paidAt', 'state.shippedAt', DateDiffUnit.DAY),
|
|
240
|
+
* 'daysToShip',
|
|
241
|
+
* );
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
terms<FIELDS extends string>(input: FIELDS | AggregationExpression<FIELDS>, alias: string, { missingKey, scope }?: TermsAggregationOptions): TermsAggregationGroup<FIELDS>;
|
|
245
|
+
/**
|
|
246
|
+
* Groups a number field, or a computed expression, into buckets of equal
|
|
247
|
+
* width. `{ type: 'histogram', field | expression, interval, alias }`.
|
|
248
|
+
*
|
|
249
|
+
* @param input - The number field to bucket, or an expression in its
|
|
250
|
+
* place (Wow 9.2 and later, an expensive computation).
|
|
251
|
+
* @param alias - The name of the bucket column in the result rows.
|
|
252
|
+
* @param options.interval - The bucket width.
|
|
253
|
+
* @param options.scope - What the field is relative to when the query
|
|
254
|
+
* expands elements: `ROOT` groups the elements by a field of their root
|
|
255
|
+
* record. Wow 9.9 and later.
|
|
256
|
+
* @throws TypeError when `interval` is not finite and greater than 0, or
|
|
257
|
+
* `field` or `alias` is invalid.
|
|
258
|
+
* @example
|
|
259
|
+
* ```typescript
|
|
260
|
+
* aggregation.histogram('state.amount', 'amountBand', { interval: 100 });
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
histogram<FIELDS extends string>(input: FIELDS | AggregationExpression<FIELDS>, alias: string, { interval, scope }: HistogramAggregationOptions): HistogramAggregationGroup<FIELDS>;
|
|
264
|
+
/**
|
|
265
|
+
* Groups a time field into calendar buckets.
|
|
266
|
+
* `{ type: 'date-histogram', field, unit, alias, timeZone?, dense? }`.
|
|
267
|
+
*
|
|
268
|
+
* @param field - The time field (epoch milliseconds) to bucket.
|
|
269
|
+
* @param alias - The name of the bucket column in the result rows.
|
|
270
|
+
* @param options.unit - The calendar unit of a bucket.
|
|
271
|
+
* @param options.timeZone - The zone buckets are cut in. Sent only when
|
|
272
|
+
* set; the server reads none as `UTC`.
|
|
273
|
+
* @param options.dense - Whether the empty buckets of the range are filled
|
|
274
|
+
* in.
|
|
275
|
+
* @param options.scope - What the field is relative to when the query
|
|
276
|
+
* expands elements: `ROOT` groups the elements by a field of their root
|
|
277
|
+
* record. Wow 9.9 and later.
|
|
278
|
+
* @throws TypeError when `unit` is not an `AggregationDateUnit`,
|
|
279
|
+
* `timeZone` is blank, `dense` is not a boolean, or `field` or `alias` is
|
|
280
|
+
* invalid.
|
|
281
|
+
* @example
|
|
282
|
+
* ```typescript
|
|
283
|
+
* aggregation.dateHistogram('createTime', 'day', {
|
|
284
|
+
* unit: AggregationDateUnit.DAY,
|
|
285
|
+
* timeZone: 'Asia/Shanghai',
|
|
286
|
+
* });
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
dateHistogram<FIELDS extends string>(field: FIELDS, alias: string, { unit, timeZone, dense, scope }: DateHistogramAggregationOptions): DateHistogramAggregationGroup<FIELDS>;
|
|
290
|
+
/**
|
|
291
|
+
* Groups a time field by one calendar part of each instant, such as the
|
|
292
|
+
* weekday or the hour, so records from different days share a bucket.
|
|
293
|
+
* `{ type: 'date-part', field, part, alias, timeZone?, dense? }`.
|
|
294
|
+
*
|
|
295
|
+
* The group's keys in the result rows are integers: `DAY_OF_WEEK` is the
|
|
296
|
+
* ISO weekday, 1 (Monday) to 7 (Sunday); `DAY_OF_MONTH` 1 to 31;
|
|
297
|
+
* `HOUR_OF_DAY` 0 to 23 on the wall clock of `timeZone`; `MONTH_OF_YEAR`
|
|
298
|
+
* 1 to 12. With `dense`, every key of that domain comes back, those
|
|
299
|
+
* without records carrying each metric's empty value; `dense` needs the
|
|
300
|
+
* group to be the query's only one. Wow 9.2 and later.
|
|
301
|
+
*
|
|
302
|
+
* @param field - The time field (epoch milliseconds) to read the part of.
|
|
303
|
+
* @param alias - The name of the part column in the result rows.
|
|
304
|
+
* @param options.part - The calendar part to group by.
|
|
305
|
+
* @param options.timeZone - The zone the part is read in. Sent only when
|
|
306
|
+
* set; the server reads none as `UTC`.
|
|
307
|
+
* @param options.dense - Whether every key of the part's domain is
|
|
308
|
+
* returned.
|
|
309
|
+
* @param options.scope - What the field is relative to when the query
|
|
310
|
+
* expands elements: `ROOT` groups the elements by a field of their root
|
|
311
|
+
* record. Wow 9.9 and later.
|
|
312
|
+
* @throws TypeError when `part` is not an `AggregationDatePart`,
|
|
313
|
+
* `timeZone` is blank, `dense` is not a boolean, or `field` or `alias` is
|
|
314
|
+
* invalid.
|
|
315
|
+
* @example
|
|
316
|
+
* ```typescript
|
|
317
|
+
* aggregation.datePart('createTime', 'weekday', {
|
|
318
|
+
* part: AggregationDatePart.DAY_OF_WEEK,
|
|
319
|
+
* timeZone: 'Asia/Shanghai',
|
|
320
|
+
* });
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
datePart<FIELDS extends string>(field: FIELDS, alias: string, { part, timeZone, dense, scope }: DatePartAggregationOptions): DatePartAggregationGroup<FIELDS>;
|
|
324
|
+
};
|
|
325
|
+
export {};
|