Skip to content

Commit 5310fea

Browse files
authored
[DOCS] Add anchors for scripted metric aggregations
Related to #53274 This PR adds anchors to sections in https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-metrics-scripted-metric-aggregation.html so that they can be linked from other pages.
1 parent 0f0091e commit 5310fea

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/reference/aggregations/metrics/scripted-metric-aggregation.asciidoc

+8-3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Verify this response as well but in a hidden block.
102102

103103
For more details on specifying scripts see <<modules-scripting, script documentation>>.
104104

105+
[[_allowed_return_types]]
105106
==== Allowed return types
106107

107108
Whilst 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

116118
The 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
139141
In the above example, the `reduce_script` iterates through the `profit` returned by each shard summing the values before returning the
140142
final combined profit which will be returned in the response of the aggregation.
141143

142-
==== Worked Example
144+
[[_worked_example]]
145+
==== Worked example
143146

144147
Imagine 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]
261265
params:: 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

273278
If a parent bucket of the scripted metric aggregation does not collect any documents an empty aggregation response will be returned from the
274279
shard 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

Comments
 (0)