Skip to content

Commit 9800df6

Browse files
authored
Document missing_order param for composite aggregations (#77839) (#78302)
Documents the missing_order parameter for composite aggregations introduced in #76740
1 parent 821f36b commit 9800df6

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

docs/reference/aggregations/bucket/composite-aggregation.asciidoc

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -599,19 +599,30 @@ GET /_search
599599
"aggs": {
600600
"my_buckets": {
601601
"composite": {
602-
"sources": [
603-
{ "product_name": { "terms": { "field": "product", "missing_bucket": true } } }
604-
]
602+
"sources": [{
603+
"product_name": {
604+
"terms": {
605+
"field": "product",
606+
"missing_bucket": true,
607+
"missing_order": "last"
608+
}
609+
}
610+
}]
605611
}
606612
}
607613
}
608614
}
609615
--------------------------------------------------
610616

611-
In the example above the source `product_name` will emit an explicit `null` value
612-
for documents without a value for the field `product`.
613-
The `order` specified in the source dictates whether the `null` values should rank
614-
first (ascending order, `asc`) or last (descending order, `desc`).
617+
In the above example, the `product_name` source emits an explicit `null` bucket
618+
for documents without a `product` value. This bucket is placed last.
619+
620+
You can control the position of the `null` bucket using the optional
621+
`missing_order` parameter. If `missing_order` is `first` or `last`, the `null`
622+
bucket is placed in the respective first or last position. If `missing_order` is
623+
omitted or `default`, the source's `order` determines the bucket's position. If
624+
`order` is `asc` (ascending), the bucket is in the first position. If `order` is
625+
`desc` (descending), the bucket is in the last position.
615626

616627
==== Size
617628

0 commit comments

Comments
 (0)