Skip to content

Commit cda51c1

Browse files
authored
Add note about AggregateOrder parsing lazyness (#1777) (#1778)
1 parent ff80fef commit cda51c1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

output/schema/schema.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_types/aggregations/bucket.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ export class TermsAggregation extends BucketAggregationBase {
358358
size?: integer
359359
}
360360

361+
// Note: ES is very lazy when parsing this data type: it accepts any number of properties in the objects below,
362+
// but will only keep the *last* property in JSON document order and ignore others.
363+
// This means that something like `"order": { "downloads": "desc", "_key": "asc" }` will actually be interpreted
364+
// as `"order": [ { "_key": "asc" } ]`
361365
export type AggregateOrder =
362366
| SingleKeyDictionary<Field, SortOrder>
363367
| SingleKeyDictionary<Field, SortOrder>[]

0 commit comments

Comments
 (0)