Skip to content

Commit 9b9411b

Browse files
committed
fix search
1 parent dfa2e76 commit 9b9411b

File tree

5 files changed

+109
-7
lines changed

5 files changed

+109
-7
lines changed

specification/_types/Geo.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ export type GeoTile = string
9595

9696
/** A map hex cell (H3) reference */
9797
export type GeoHexCell = string
98-
99-
export class LatLon {
100-
lat: double
101-
lon: double
102-
}
103-
10498
/**
10599
* A latitude/longitude as a 2 dimensional point. It can be represented in various ways:
106100
* - as a `{lat, long}` object
@@ -128,6 +122,11 @@ export class LatLonGeoLocation {
128122
lon: double
129123
}
130124

125+
export class CartesianPoint {
126+
x: double
127+
y: double
128+
}
129+
131130
export class GeoHashLocation {
132131
geohash: GeoHash
133132
}

specification/_types/aggregations/Aggregate.ts

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020
import { CompositeAggregateKey } from '@_types/aggregations/bucket'
2121
import { AggregateName, Field, FieldValue, Metadata } from '@_types/common'
2222
import {
23+
CartesianPoint,
2324
GeoBounds,
2425
GeoHash,
2526
GeoHexCell,
2627
GeoLine,
2728
GeoLocation,
28-
GeoTile
29+
GeoTile,
30+
TopLeftBottomRightGeoBounds
2931
} from '@_types/Geo'
3032
import { double, integer, long } from '@_types/Numeric'
3133
import { DurationLarge, EpochTime, UnitMillis } from '@_types/Time'
@@ -59,11 +61,14 @@ export type Aggregate =
5961
| SimpleValueAggregate
6062
| DerivativeAggregate
6163
| BucketMetricValueAggregate
64+
| ChangePointAggregate
6265
// Multi value
6366
| StatsAggregate
6467
| StatsBucketAggregate
6568
| ExtendedStatsAggregate
6669
| ExtendedStatsBucketAggregate
70+
| CartesianBoundsAggregate
71+
| CartesianCentroidAggregate
6772
// Geo
6873
| GeoBoundsAggregate
6974
| GeoCentroidAggregate
@@ -322,6 +327,17 @@ export class ExtendedStatsAggregate extends StatsAggregate {
322327
/** @variant name=extended_stats_bucket */
323328
export class ExtendedStatsBucketAggregate extends ExtendedStatsAggregate {}
324329

330+
/** @variant name=cartesian_bounds */
331+
export class CartesianBoundsAggregate extends AggregateBase {
332+
bounds?: TopLeftBottomRightGeoBounds
333+
}
334+
335+
/** @variant name=cartesian_centroid */
336+
export class CartesianCentroidAggregate extends AggregateBase {
337+
count: long
338+
location?: CartesianPoint
339+
}
340+
325341
//----- Geo
326342

327343
/**
@@ -369,6 +385,65 @@ export class MultiBucketBase
369385
doc_count: long
370386
}
371387

388+
/** @variant name=change_point */
389+
export class ChangePointAggregate extends MultiBucketAggregateBase<ChangePointBucket> {
390+
type: ChangeType
391+
bucket?: ChangePointBucket
392+
}
393+
394+
export class ChangePointBucket extends MultiBucketBase {
395+
key: FieldValue
396+
}
397+
398+
export type ChangeType =
399+
| Dip
400+
| DistributionChange
401+
| Indeterminable
402+
| NonStationary
403+
| Spike
404+
| Stationary
405+
| StepChange
406+
| TrendChange
407+
408+
export class AbstractChangePoint {
409+
p_value: double
410+
change_point: integer
411+
}
412+
413+
/** @variant name=dip */
414+
export class Dip extends AbstractChangePoint {}
415+
416+
/** @variant name=distribution_change */
417+
export class DistributionChange extends AbstractChangePoint {}
418+
419+
/** @variant name=spike */
420+
export class Spike extends AbstractChangePoint {}
421+
422+
/** @variant name=step_change */
423+
export class StepChange extends AbstractChangePoint {}
424+
425+
/** @variant name=indeterminable */
426+
export class Indeterminable {
427+
reason: string
428+
}
429+
430+
/** @variant name=non_stationary */
431+
export class NonStationary {
432+
p_value: double
433+
r_value: double
434+
trend: string
435+
}
436+
437+
/** @variant name=stationary */
438+
export class Stationary {}
439+
440+
/** @variant name=trend_change */
441+
export class TrendChange {
442+
p_value: double
443+
r_value: double
444+
change_point: integer
445+
}
446+
372447
/**
373448
* @variant name=histogram
374449
* @ext_doc_id search-aggregations-bucket-histogram-aggregation

specification/_types/aggregations/AggregationContainer.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ import {
6060
AverageAggregation,
6161
BoxplotAggregation,
6262
CardinalityAggregation,
63+
CartesianBoundsAggregation,
64+
CartesianCentroidAggregation,
6365
ExtendedStatsAggregation,
6466
GeoBoundsAggregation,
6567
GeoCentroidAggregation,
@@ -87,6 +89,7 @@ import {
8789
BucketScriptAggregation,
8890
BucketSelectorAggregation,
8991
BucketSortAggregation,
92+
ChangePointAggregation,
9093
CumulativeCardinalityAggregation,
9194
CumulativeSumAggregation,
9295
DerivativeAggregation,
@@ -183,13 +186,31 @@ export class AggregationContainer {
183186
* @ext_doc_id search-aggregations-metrics-cardinality-aggregation
184187
*/
185188
cardinality?: CardinalityAggregation
189+
/**
190+
* A metric aggregation that computes the spatial bounding box containing all values for a Point or Shape field.
191+
* @ext_doc_id search-aggregations-metrics-cartesian-bounds-aggregation
192+
*/
193+
cartesian_bounds?: CartesianBoundsAggregation
194+
/**
195+
* A metric aggregation that computes the weighted centroid from all coordinate values for point and shape fields.
196+
* @ext_doc_id search-aggregations-metrics-cartesian-centroid-aggregation
197+
*/
198+
cartesian_centroid?: CartesianCentroidAggregation
186199
/**
187200
* A multi-bucket aggregation that groups semi-structured text into buckets.
188201
* @ext_doc_id search-aggregations-bucket-categorize-text-aggregation
189202
* @availability stack stability=experimental
190203
* @availability serverless stability=experimental
191204
*/
192205
categorize_text?: CategorizeTextAggregation
206+
/**
207+
* A sibling pipeline that detects, spikes, dips, and change points in a metric.
208+
* Given a distribution of values provided by the sibling multi-bucket aggregation,
209+
* this aggregation indicates the bucket of any spike or dip and/or the bucket at which
210+
* the largest change in the distribution of values, if they are statistically significant.
211+
* @ext_doc_id search-aggregations-change-point-aggregation
212+
*/
213+
change_point?: ChangePointAggregation
193214
/**
194215
* A single bucket aggregation that selects child documents that have the specified type, as defined in a `join` field.
195216
* @ext_doc_id search-aggregations-bucket-children-aggregation
@@ -245,6 +266,7 @@ export class AggregationContainer {
245266
/**
246267
* A bucket aggregation which finds frequent item sets, a form of association rules mining that identifies items that often occur together.
247268
* @ext_doc_id search-aggregations-bucket-frequent-item-sets-aggregation
269+
* @aliases frequent_items
248270
*/
249271
frequent_item_sets?: FrequentItemSetsAggregation
250272
/**

specification/_types/aggregations/metric.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ export class ExtendedStatsAggregation extends FormatMetricAggregationBase {
111111
sigma?: double
112112
}
113113

114+
export class CartesianBoundsAggregation extends MetricAggregationBase {}
115+
116+
export class CartesianCentroidAggregation extends MetricAggregationBase {}
117+
114118
/**
115119
* @ext_doc_id search-aggregations-metrics-geobounds-aggregation
116120
*/

specification/_types/aggregations/pipeline.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ export class BucketSortAggregation extends Aggregation {
203203
sort?: Sort
204204
}
205205

206+
export class ChangePointAggregation extends PipelineAggregationBase {}
207+
206208
/**
207209
* @ext_doc_id search-aggregations-pipeline-cumulative-cardinality-aggregation
208210
*/

0 commit comments

Comments
 (0)