File tree 1 file changed +18
-7
lines changed
docs/reference/aggregations/bucket
1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -599,19 +599,30 @@ GET /_search
599
599
"aggs": {
600
600
"my_buckets": {
601
601
"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
+ }]
605
611
}
606
612
}
607
613
}
608
614
}
609
615
--------------------------------------------------
610
616
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.
615
626
616
627
==== Size
617
628
You can’t perform that action at this time.
0 commit comments