From 105e3b162757da5e0ac7f164cb42f03200143f50 Mon Sep 17 00:00:00 2001 From: James Rodewig <40268737+jrodewig@users.noreply.github.com> Date: Tue, 2 Mar 2021 10:59:13 -0500 Subject: [PATCH] Reuse syntax block --- .../pipeline/avg-bucket-aggregation.asciidoc | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/docs/reference/aggregations/pipeline/avg-bucket-aggregation.asciidoc b/docs/reference/aggregations/pipeline/avg-bucket-aggregation.asciidoc index 6de270b5d55c1..08d0932d1c422 100644 --- a/docs/reference/aggregations/pipeline/avg-bucket-aggregation.asciidoc +++ b/docs/reference/aggregations/pipeline/avg-bucket-aggregation.asciidoc @@ -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 @@ -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 { @@ -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]