Browse Source

[DOCS] Clarify behaviour of scripted-metric arg with empty parent buckets

Colin Goodheart-Smithe 8 years ago
parent
commit
5e7a79636d

+ 6 - 0
docs/reference/aggregations/metrics/scripted-metric-aggregation.asciidoc

@@ -278,3 +278,9 @@ params::           Optional. An object whose contents will be passed as variable
     "_agg" : {}
 }
 --------------------------------------------------
+
+==== Empty Buckets
+
+If a parent bucket of the scripted metric aggregation does not collect any documents an empty aggregation response will be returned from the
+shard with a `null` value. In this case the `reduce_script`'s `_aggs` variable will contain `null` as a response from that shard.  
+`reduce_script`'s should therefore expect and deal with `null` responses from shards.