Skip to content

Commit 44d8b0f

Browse files
authored
Add note about AggregateOrder parsing lazyness (#1777)
1 parent 81791d0 commit 44d8b0f

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

output/schema/schema.json

Lines changed: 10 additions & 10 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
@@ -392,6 +392,10 @@ export class TermsAggregation extends BucketAggregationBase {
392392
format?: string
393393
}
394394

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

0 commit comments

Comments
 (0)