<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Stats_bucket on INFINI Pizza</title><link>https://pizza.rs/tags/stats_bucket/</link><description>Recent content in Stats_bucket on INFINI Pizza</description><generator>Hugo</generator><language>en</language><atom:link href="https://pizza.rs/tags/stats_bucket/index.xml" rel="self" type="application/rss+xml"/><item><title>Stats bucket aggregation</title><link>https://pizza.rs/docs/references/aggregation/pipeline/stats-bucket/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://pizza.rs/docs/references/aggregation/pipeline/stats-bucket/</guid><description>&lt;h1 id="stats-bucket-aggregation">
 Stats bucket aggregation
 &lt;a class="anchor" href="#stats-bucket-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A sibling pipeline aggregation returning count/min/max/avg/sum of a
metric &lt;strong>across buckets&lt;/strong> — the stats of the per-bucket values. One
call replaces four: where &lt;code>avg_bucket&lt;/code>, &lt;code>min_bucket&lt;/code> and &lt;code>max_bucket&lt;/code>
each reduce the bucket list to a single number, &lt;code>stats_bucket&lt;/code> returns
the whole summary object beside the aggregation it describes.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="s2">&amp;#34;day_stats&amp;#34;&lt;/span>&lt;span class="err">:&lt;/span> &lt;span class="p">{&lt;/span> &lt;span class="nt">&amp;#34;stats_bucket&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span> &lt;span class="nt">&amp;#34;buckets_path&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;per_day&amp;gt;revenue&amp;#34;&lt;/span> &lt;span class="p">}&lt;/span> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="how-it-works">
 How it works
 &lt;a class="anchor" href="#how-it-works">#&lt;/a>
&lt;/h2>
&lt;p>&lt;code>stats_bucket&lt;/code> is declared &lt;strong>next to&lt;/strong> the bucket aggregation it
consumes and runs after every regular aggregation — including the
distributed merge — has finished. It walks the parent&amp;rsquo;s finished
buckets, collects one number per bucket, and emits the 
 &lt;a href="https://pizza.rs/docs/references/aggregation/metric/stats/">&lt;code>stats&lt;/code>&lt;/a>
result object over that sample:&lt;/p></description></item></channel></rss>