@@ -102,6 +102,7 @@ Verify this response as well but in a hidden block.
102102
103103For more details on specifying scripts see <<modules-scripting, script documentation>>.
104104
105+ [[_allowed_return_types]]
105106==== Allowed return types
106107
107108Whilst any valid script object can be used within a single script, the scripts must return or store in the `state` object only the following types:
@@ -111,6 +112,7 @@ Whilst any valid script object can be used within a single script, the scripts m
111112* Map (containing only keys and values of the types listed here)
112113* Array (containing elements of only the types listed here)
113114
115+ [[_scope_of_scripts]]
114116==== Scope of scripts
115117
116118The scripted metric aggregation uses scripts at 4 stages of its execution:
@@ -139,7 +141,8 @@ reduce_script:: Executed once on the coordinating node after all shards have
139141In the above example, the `reduce_script` iterates through the `profit` returned by each shard summing the values before returning the
140142final combined profit which will be returned in the response of the aggregation.
141143
142- ==== Worked Example
144+ [[_worked_example]]
145+ ==== Worked example
143146
144147Imagine a situation where you index the following documents into an index with 2 shards:
145148
@@ -255,7 +258,8 @@ produce the response:
255258--------------------------------------------------
256259// NOTCONSOLE
257260
258- ==== Other Parameters
261+ [[_other_parameters]]
262+ ==== Other parameters
259263
260264[horizontal]
261265params:: Optional. An object whose contents will be passed as variables to the `init_script`, `map_script` and `combine_script`. This can be
@@ -268,7 +272,8 @@ params:: Optional. An object whose contents will be passed as variable
268272--------------------------------------------------
269273// NOTCONSOLE
270274
271- ==== Empty Buckets
275+ [[_empty_buckets]]
276+ ==== Empty buckets
272277
273278If a parent bucket of the scripted metric aggregation does not collect any documents an empty aggregation response will be returned from the
274279shard with a `null` value. In this case the `reduce_script`'s `states` variable will contain `null` as a response from that shard.
0 commit comments