Skip to content

Commit

Permalink
Reuse syntax block
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig committed Mar 2, 2021
1 parent 16a31df commit 105e3b1
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@ sibling aggregation must be a multi-bucket aggregation.
[[avg-bucket-agg-syntax]]
==== Syntax

[source,js]
[source,js,indent=0]
----
{
"avg_bucket": {
"buckets_path": "the_sum",
"gap_policy": "skip",
"format": "#0.00;(#0.00)"
}
}
include::avg-bucket-aggregation.asciidoc[tag=avg-bucket-agg-syntax]
----
// NOTCONSOLE

Expand Down Expand Up @@ -59,7 +53,7 @@ a `format` is specified in the request.
The following `avg_monthly_sales` aggregation uses `avg_bucket` to calculate
average sales per month:

[source,console]
[source,console,subs="+specialchars"]
----
POST _search
{
Expand All @@ -79,19 +73,19 @@ POST _search
}
},
"avg_monthly_sales": {
// tag::avg-bucket-agg-syntax[]
"avg_bucket": {
"buckets_path": "sales_per_month>sales", <1>
"format": "#,##0.00"
"buckets_path": "sales_per_month>sales",
"gap_policy": "skip",
"format": "#,##0.00;(#,##0.00)"
}
// end::avg-bucket-agg-syntax[]
}
}
}
----
// TEST[setup:sales]

<1> Calculates the mean value of the `sales` aggregation in the
`sales_per_month` date histogram.

The request returns the following response:

[source,console-result]
Expand Down

0 comments on commit 105e3b1

Please sign in to comment.