<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bucket aggregations on INFINI Pizza</title><link>/docs/references/aggregation/bucket/</link><description>Recent content in Bucket aggregations on INFINI Pizza</description><generator>Hugo</generator><language>en</language><atom:link href="/docs/references/aggregation/bucket/index.xml" rel="self" type="application/rss+xml"/><item><title>Terms aggregation</title><link>/docs/references/aggregation/bucket/terms/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/terms/</guid><description>&lt;h1 id="terms-aggregation">
 Terms aggregation
 &lt;a class="anchor" href="#terms-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket value source based aggregation where buckets are dynamically
built - one per unique value.&lt;/p>
&lt;h2 id="examples">
 Examples
 &lt;a class="anchor" href="#examples">#&lt;/a>
&lt;/h2>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;by_type&amp;#34;: {
 &amp;#34;terms&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;type&amp;#34;,
 &amp;#34;size&amp;#34;: 10
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">POST /_search
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;genres&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;terms&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;genre&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Response:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ...
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggregations&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;genres&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;doc_count_error_upper_bound&amp;#34;&lt;/span>: 0,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;sum_other_doc_count&amp;#34;&lt;/span>: 0,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;buckets&amp;#34;&lt;/span>: &lt;span class="o">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;key&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;electronic&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;doc_count&amp;#34;&lt;/span>: &lt;span class="m">6&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;key&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;rock&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;doc_count&amp;#34;&lt;/span>: &lt;span class="m">3&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;key&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;jazz&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;doc_count&amp;#34;&lt;/span>: &lt;span class="m">2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="parameters-for-terms">
 Parameters for &lt;code>terms&lt;/code>
 &lt;a class="anchor" href="#parameters-for-terms">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>field&lt;/code> &lt;br>
(Required, string) Field you wish to aggregate.&lt;/li>
&lt;li>&lt;code>size&lt;/code> &lt;br>
(Optional, integer) Maximum number of buckets to return. Defaults to &lt;code>10&lt;/code>.&lt;/li>
&lt;li>&lt;code>min_doc_count&lt;/code> &lt;br>
(Optional, integer) Drop buckets with fewer matching documents. Defaults
to &lt;code>1&lt;/code>; &lt;code>0&lt;/code> keeps empty buckets — only meaningful together with an
explicit &lt;code>include&lt;/code> list.&lt;/li>
&lt;li>&lt;code>missing&lt;/code> &lt;br>
(Optional, value) Value substituted for documents without the field (any
scalar; those documents land in one bucket keyed by it).&lt;/li>
&lt;li>&lt;code>include&lt;/code> &lt;br>
(Optional) Restricts bucket keys: an exact-value array, a wildcard
string (&lt;code>prefix*&lt;/code> / &lt;code>*suffix&lt;/code>), or &lt;code>{ &amp;quot;partition&amp;quot;: &amp;lt;p&amp;gt;, &amp;quot;num_partitions&amp;quot;: &amp;lt;n&amp;gt; }&lt;/code>.&lt;/li>
&lt;li>&lt;code>exclude&lt;/code> &lt;br>
(Optional) Excludes bucket keys: an exact-value array or a wildcard
string (negated &lt;code>include&lt;/code>).&lt;/li>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Optional, object) Nested sub-aggregations, computed per bucket.&lt;/li>
&lt;/ul></description></item><item><title>Multi terms aggregation</title><link>/docs/references/aggregation/bucket/multi-terms/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/multi-terms/</guid><description>&lt;h1 id="multi-terms-aggregation">
 Multi terms aggregation
 &lt;a class="anchor" href="#multi-terms-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation like 
 &lt;a href="/docs/references/aggregation/bucket/terms/">&lt;code>terms&lt;/code>&lt;/a>, but the bucket
key is a TUPLE of values from several fields — e.g. every
(merchant, status) combination.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;pairs&amp;#34;: {
 &amp;#34;multi_terms&amp;#34;: {
 &amp;#34;terms&amp;#34;: [
 { &amp;#34;field&amp;#34;: &amp;#34;merchant&amp;#34; },
 { &amp;#34;field&amp;#34;: &amp;#34;status&amp;#34; }
 ],
 &amp;#34;size&amp;#34;: 5
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>Each bucket&amp;rsquo;s &lt;code>key&lt;/code> is an array &lt;code>[merchant, status]&lt;/code>.&lt;/p></description></item><item><title>Rare terms aggregation</title><link>/docs/references/aggregation/bucket/rare-terms/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/rare-terms/</guid><description>&lt;h1 id="rare-terms-aggregation">
 Rare terms aggregation
 &lt;a class="anchor" href="#rare-terms-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation that keeps only RARE terms — bucket keys
whose document count is at or below &lt;code>max_doc_count&lt;/code>. The mirror image of

 &lt;a href="/docs/references/aggregation/bucket/terms/">&lt;code>terms&lt;/code>&lt;/a> for finding the long tail.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Every product type sells ≥10 times; raise the bar to 15 and only
&lt;code>sticker&lt;/code> (10 sales) survives:&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;rare_types&amp;#34;: {
 &amp;#34;rare_terms&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;type&amp;#34;,
 &amp;#34;max_doc_count&amp;#34;: 15
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;h2 id="parameters-for-rare_terms">
 Parameters for &lt;code>rare_terms&lt;/code>
 &lt;a class="anchor" href="#parameters-for-rare_terms">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>field&lt;/code> &lt;br>
(Required, string) Keyword field you wish to aggregate.&lt;/li>
&lt;li>&lt;code>max_doc_count&lt;/code> &lt;br>
(Optional, integer, default: &lt;code>1&lt;/code>) Maximum document count for a term to
be considered rare.&lt;/li>
&lt;li>&lt;code>include&lt;/code> / &lt;code>exclude&lt;/code> &lt;br>
(Optional) Restrict candidate terms (exact values or wildcard
patterns).&lt;/li>
&lt;/ul></description></item><item><title>Significant terms aggregation</title><link>/docs/references/aggregation/bucket/significant-terms/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/significant-terms/</guid><description>&lt;h1 id="significant-terms-aggregation">
 Significant terms aggregation
 &lt;a class="anchor" href="#significant-terms-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation returning terms that are unusually frequent
in the current scope (foreground) compared with the whole index
(background) — the classic &amp;ldquo;what&amp;rsquo;s special about this subset&amp;rdquo; query.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Which merchants over-index inside &lt;code>pending&lt;/code> sales?&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;query&amp;#34;: {
 &amp;#34;term&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;status&amp;#34;, &amp;#34;value&amp;#34;: &amp;#34;pending&amp;#34; }
 },
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;notable_merchants&amp;#34;: {
 &amp;#34;significant_terms&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;merchant&amp;#34;,
 &amp;#34;size&amp;#34;: 5
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>Buckets carry &lt;code>doc_count&lt;/code> (foreground) and &lt;code>bg_count&lt;/code> (background) —
with evenly-distributed demo data the scores stay low; skew your own
data and the winners surface.&lt;/p></description></item><item><title>Range aggregation</title><link>/docs/references/aggregation/bucket/range/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/range/</guid><description>&lt;h1 id="range-aggregation">
 Range aggregation
 &lt;a class="anchor" href="#range-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation over numeric fields where each bucket is a
user-defined range.&lt;/p>
&lt;h2 id="examples">
 Examples
 &lt;a class="anchor" href="#examples">#&lt;/a>
&lt;/h2>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;price_ranges&amp;#34;: {
 &amp;#34;range&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;price&amp;#34;,
 &amp;#34;ranges&amp;#34;: [
 {
 &amp;#34;key&amp;#34;: &amp;#34;low&amp;#34;,
 &amp;#34;to&amp;#34;: 50
 },
 {
 &amp;#34;key&amp;#34;: &amp;#34;mid&amp;#34;,
 &amp;#34;from&amp;#34;: 50,
 &amp;#34;to&amp;#34;: 100
 },
 {
 &amp;#34;key&amp;#34;: &amp;#34;high&amp;#34;,
 &amp;#34;from&amp;#34;: 100
 }
 ]
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">POST /sales/_search
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;price_ranges&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;range&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;price&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;ranges&amp;#34;&lt;/span>: &lt;span class="o">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;to&amp;#34;&lt;/span>: &lt;span class="m">100&lt;/span> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;from&amp;#34;&lt;/span>: 100, &lt;span class="s2">&amp;#34;to&amp;#34;&lt;/span>: &lt;span class="m">200&lt;/span> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;from&amp;#34;&lt;/span>: &lt;span class="m">200&lt;/span> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Response:&lt;/p></description></item><item><title>Date range aggregation</title><link>/docs/references/aggregation/bucket/date-range/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/date-range/</guid><description>&lt;h1 id="date-range-aggregation">
 Date range aggregation
 &lt;a class="anchor" href="#date-range-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation like 
 &lt;a href="/docs/references/aggregation/bucket/range/">&lt;code>range&lt;/code>&lt;/a>, but for date
fields. Each bucket is a from/to interval; bounds accept epoch
milliseconds.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Split logs at 2024-06-16 (epoch millis &lt;code>1718534400000&lt;/code>):&lt;/p>
&lt;div class="pizza-playground" data-dataset="logs" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;query&amp;#34;: {
 &amp;#34;range&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;date&amp;#34;, &amp;#34;gte&amp;#34;: 1718534400000 }
 },
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;by_period&amp;#34;: {
 &amp;#34;date_range&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;date&amp;#34;,
 &amp;#34;ranges&amp;#34;: [
 { &amp;#34;to&amp;#34;: 1718534400000 },
 { &amp;#34;from&amp;#34;: 1718534400000 }
 ]
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>The &lt;code>query&lt;/code> narrows the scope to the second half of June; the first
bucket is then empty and the second holds every scoped log.&lt;/p></description></item><item><title>Histogram aggregation</title><link>/docs/references/aggregation/bucket/histogram/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/histogram/</guid><description>&lt;h1 id="histogram-aggregation">
 Histogram aggregation
 &lt;a class="anchor" href="#histogram-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation over numeric fields that applies a fixed
interval to build the buckets.&lt;/p>
&lt;h2 id="examples">
 Examples
 &lt;a class="anchor" href="#examples">#&lt;/a>
&lt;/h2>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;prices&amp;#34;: {
 &amp;#34;histogram&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;price&amp;#34;,
 &amp;#34;interval&amp;#34;: 100
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">POST /sales/_search
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;prices&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;histogram&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;price&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;interval&amp;#34;&lt;/span>: &lt;span class="m">50&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Response:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ...
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggregations&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;prices&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;buckets&amp;#34;&lt;/span>: &lt;span class="o">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;key&amp;#34;&lt;/span>: 0.0, &lt;span class="s2">&amp;#34;doc_count&amp;#34;&lt;/span>: &lt;span class="m">2&lt;/span> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;key&amp;#34;&lt;/span>: 50.0, &lt;span class="s2">&amp;#34;doc_count&amp;#34;&lt;/span>: &lt;span class="m">4&lt;/span> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;key&amp;#34;&lt;/span>: 100.0, &lt;span class="s2">&amp;#34;doc_count&amp;#34;&lt;/span>: &lt;span class="m">1&lt;/span> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="parameters-for-histogram">
 Parameters for &lt;code>histogram&lt;/code>
 &lt;a class="anchor" href="#parameters-for-histogram">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>field&lt;/code> &lt;br>
(Required, string) Field you wish to aggregate (must be numeric).&lt;/li>
&lt;li>&lt;code>interval&lt;/code> &lt;br>
(Required, number) Bucket width.&lt;/li>
&lt;li>&lt;code>offset&lt;/code> &lt;br>
(Optional, number, default: &lt;code>0.0&lt;/code>) Shift the bucket boundaries.&lt;/li>
&lt;li>&lt;code>min_doc_count&lt;/code> &lt;br>
(Optional, integer, default: &lt;code>0&lt;/code>) Only return buckets with at least
this many documents.&lt;/li>
&lt;li>&lt;code>hard_bounds&lt;/code> &lt;br>
(Optional, object) Restrict bucket generation to &lt;code>[min, max)&lt;/code> —
buckets fully outside are dropped even with &lt;code>min_doc_count: 0&lt;/code>.&lt;/li>
&lt;li>&lt;code>extended_bounds&lt;/code> &lt;br>
(Optional, object) Widen the bucket range beyond the data extent
(empty buckets are materialized up to these bounds when
&lt;code>min_doc_count&lt;/code> is &lt;code>0&lt;/code>). Can only extend, never shrink below the data
extent.&lt;/li>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Optional, object) Nested sub-aggregations, computed per bucket.&lt;/li>
&lt;/ul>
&lt;p>For date fields, see the

 &lt;a href="/docs/references/aggregation/bucket/date-histogram/">date histogram aggregation&lt;/a>.&lt;/p></description></item><item><title>Variable width histogram aggregation</title><link>/docs/references/aggregation/bucket/variable-width-histogram/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/variable-width-histogram/</guid><description>&lt;h1 id="variable-width-histogram-aggregation">
 Variable width histogram aggregation
 &lt;a class="anchor" href="#variable-width-histogram-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation like 
 &lt;a href="/docs/references/aggregation/bucket/histogram/">&lt;code>histogram&lt;/code>&lt;/a>, but
bucket edges adapt to the data so each bucket holds roughly the same
number of documents.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;price_bins&amp;#34;: {
 &amp;#34;variable_width_histogram&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;price&amp;#34;,
 &amp;#34;buckets&amp;#34;: 4
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>Each bucket reports its &lt;code>min&lt;/code>/&lt;code>max&lt;/code> range and &lt;code>doc_count&lt;/code>; dense price
regions get narrower buckets.&lt;/p></description></item><item><title>Date histogram aggregation</title><link>/docs/references/aggregation/bucket/date-histogram/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/date-histogram/</guid><description>&lt;h1 id="date-histogram-aggregation">
 Date histogram aggregation
 &lt;a class="anchor" href="#date-histogram-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>This multi-bucket aggregation is similar to the normal histogram, but it can
only be used with date or date range values. Because dates are represented
internally in Elasticsearch as long values, it is possible, but not as accurate,
to use the normal histogram on dates as well. The main difference in the two
APIs is that here the interval can be specified using date/time expressions.
Time-based data requires special support because time-based intervals are not
always a fixed length.&lt;/p></description></item><item><title>Auto date histogram aggregation</title><link>/docs/references/aggregation/bucket/auto-date-histogram/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/auto-date-histogram/</guid><description>&lt;h1 id="auto-date-histogram-aggregation">
 Auto date histogram aggregation
 &lt;a class="anchor" href="#auto-date-histogram-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation like 
 &lt;a href="/docs/references/aggregation/bucket/date-histogram/">&lt;code>date_histogram&lt;/code>&lt;/a>,
but you choose the NUMBER of buckets and the engine picks the interval
that best fits.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Ask for three buckets over the sales timeline:&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;over_time&amp;#34;: {
 &amp;#34;auto_date_histogram&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;date&amp;#34;,
 &amp;#34;buckets&amp;#34;: 3
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>The engine returns roughly monthly buckets with an &lt;code>interval&lt;/code> hint on
the result.&lt;/p></description></item><item><title>IP range aggregation</title><link>/docs/references/aggregation/bucket/ip-range/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/ip-range/</guid><description>&lt;h1 id="ip-range-aggregation">
 IP range aggregation
 &lt;a class="anchor" href="#ip-range-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation like 
 &lt;a href="/docs/references/aggregation/bucket/range/">&lt;code>range&lt;/code>&lt;/a>, but for IP
addresses — buckets are CIDR masks or from/to IP bounds.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>The demo dataset has no IP-typed field (hosts are names like &lt;code>web-01&lt;/code>),
so the bucket is structurally valid but empty:&lt;/p>
&lt;div class="pizza-playground" data-dataset="logs" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;by_subnet&amp;#34;: {
 &amp;#34;ip_range&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;host&amp;#34;,
 &amp;#34;ranges&amp;#34;: [
 { &amp;#34;mask&amp;#34;: &amp;#34;10.0.0.0/8&amp;#34; },
 { &amp;#34;mask&amp;#34;: &amp;#34;192.168.0.0/16&amp;#34; }
 ]
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>On an &lt;code>ip&lt;/code> field, each bucket counts the addresses inside its subnet.&lt;/p></description></item><item><title>Filter aggregation</title><link>/docs/references/aggregation/bucket/filter/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/filter/</guid><description>&lt;h1 id="filter-aggregation">
 Filter aggregation
 &lt;a class="anchor" href="#filter-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A single-bucket aggregation that narrows the documents a nested
aggregation runs on, with a query acting as the filter condition.&lt;/p>
&lt;h2 id="examples">
 Examples
 &lt;a class="anchor" href="#examples">#&lt;/a>
&lt;/h2>
&lt;p>Average price of &lt;code>t-shirt&lt;/code> sales only:&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;hat_sales&amp;#34;: {
 &amp;#34;filter&amp;#34;: {
 &amp;#34;term&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;type&amp;#34;,
 &amp;#34;value&amp;#34;: &amp;#34;hat&amp;#34;
 }
 },
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;total&amp;#34;: {
 &amp;#34;sum&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;amount&amp;#34;
 }
 }
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">POST /sales/_search
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;t_shirts&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;filter&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;term&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;type&amp;#34;&lt;/span>, &lt;span class="s2">&amp;#34;value&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;t-shirt&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;avg_price&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;avg&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;price&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="parameters-for-filter">
 Parameters for &lt;code>filter&lt;/code>
 &lt;a class="anchor" href="#parameters-for-filter">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>&amp;lt;filter query&amp;gt;&lt;/code> &lt;br>
(Required, query) The filter condition — any single query clause in
the map form, e.g. &lt;code>{&amp;quot;term&amp;quot;: {...}}&lt;/code>.&lt;/li>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Required, object) Nested sub-aggregations, computed over only the
matching documents.&lt;/li>
&lt;/ul>
&lt;p>For multiple named filters in one aggregation, see

 &lt;a href="/docs/references/aggregation/bucket/filters/">filters&lt;/a>.&lt;/p></description></item><item><title>Filters aggregation</title><link>/docs/references/aggregation/bucket/filters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/filters/</guid><description>&lt;h1 id="filters-aggregation">
 Filters aggregation
 &lt;a class="anchor" href="#filters-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation where each bucket is defined by a named
filter — all filters run over the same document set, giving per-filter
counts (and nested sub-aggregations) side by side.&lt;/p>
&lt;h2 id="examples">
 Examples
 &lt;a class="anchor" href="#examples">#&lt;/a>
&lt;/h2>
&lt;div class="pizza-playground" data-dataset="logs" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;levels&amp;#34;: {
 &amp;#34;filters&amp;#34;: {
 &amp;#34;filters&amp;#34;: {
 &amp;#34;error&amp;#34;: {
 &amp;#34;term&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;level&amp;#34;,
 &amp;#34;value&amp;#34;: &amp;#34;error&amp;#34;
 }
 },
 &amp;#34;warn&amp;#34;: {
 &amp;#34;term&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;level&amp;#34;,
 &amp;#34;value&amp;#34;: &amp;#34;warn&amp;#34;
 }
 },
 &amp;#34;info&amp;#34;: {
 &amp;#34;term&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;level&amp;#34;,
 &amp;#34;value&amp;#34;: &amp;#34;info&amp;#34;
 }
 }
 }
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">POST /logs/_search
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;messages&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;filters&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;filters&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;errors&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;match&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;level&amp;#34;&lt;/span>, &lt;span class="s2">&amp;#34;query&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;error&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;warnings&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;match&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;level&amp;#34;&lt;/span>, &lt;span class="s2">&amp;#34;query&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;warn&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>An anonymous array of filters is also accepted; its buckets are keyed
&lt;code>&amp;quot;0&amp;quot;&lt;/code>, &lt;code>&amp;quot;1&amp;quot;&lt;/code>, …&lt;/p></description></item><item><title>Adjacency matrix aggregation</title><link>/docs/references/aggregation/bucket/adjacency-matrix/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/adjacency-matrix/</guid><description>&lt;h1 id="adjacency-matrix-aggregation">
 Adjacency matrix aggregation
 &lt;a class="anchor" href="#adjacency-matrix-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation returning every named filter&amp;rsquo;s document set
plus their pairwise INTERSECTIONS — the cross product view of several
filters.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>&lt;code>hats&lt;/code> and &lt;code>delivered&lt;/code> filters, and the documents matching both:&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;matrix&amp;#34;: {
 &amp;#34;adjacency_matrix&amp;#34;: {
 &amp;#34;filters&amp;#34;: {
 &amp;#34;hats&amp;#34;: { &amp;#34;term&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;type&amp;#34;, &amp;#34;value&amp;#34;: &amp;#34;hat&amp;#34; } },
 &amp;#34;delivered&amp;#34;: { &amp;#34;term&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;status&amp;#34;, &amp;#34;value&amp;#34;: &amp;#34;delivered&amp;#34; } }
 }
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>Buckets: &lt;code>hats&lt;/code> (30), &lt;code>delivered&lt;/code> (40) and &lt;code>delivered&amp;amp;hats&lt;/code> (10); empty
intersections are skipped.&lt;/p></description></item><item><title>Global aggregation</title><link>/docs/references/aggregation/bucket/global/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/global/</guid><description>&lt;h1 id="global-aggregation">
 Global aggregation
 &lt;a class="anchor" href="#global-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A single-bucket aggregation whose nested aggregations run over &lt;strong>all&lt;/strong>
documents in the search context, ignoring the query scope.&lt;/p>
&lt;h2 id="examples">
 Examples
 &lt;a class="anchor" href="#examples">#&lt;/a>
&lt;/h2>
&lt;p>Compare the query&amp;rsquo;s average price against the whole dataset&amp;rsquo;s:&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;all_products&amp;#34;: {
 &amp;#34;global&amp;#34;: {},
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;avg_price&amp;#34;: {
 &amp;#34;avg&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;price&amp;#34;
 }
 }
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">POST /sales/_search
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;query&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;term&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;type&amp;#34;&lt;/span>, &lt;span class="s2">&amp;#34;value&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;t-shirt&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;all_products&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;global&amp;#34;&lt;/span>: &lt;span class="o">{}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;avg_price&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;avg&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;price&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="parameters-for-global">
 Parameters for &lt;code>global&lt;/code>
 &lt;a class="anchor" href="#parameters-for-global">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Required, object) Nested sub-aggregations — the whole point of
&lt;code>global&lt;/code>: they run over every document, not just the query&amp;rsquo;s matches.&lt;/li>
&lt;/ul></description></item><item><title>Missing aggregation</title><link>/docs/references/aggregation/bucket/missing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/missing/</guid><description>&lt;h1 id="missing-aggregation">
 Missing aggregation
 &lt;a class="anchor" href="#missing-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A single-bucket aggregation of the documents that have &lt;strong>no&lt;/strong> indexed
value for a field — the inverse of the

 &lt;a href="/docs/references/search/term-level/exists/">&lt;code>exists&lt;/code> query&lt;/a>.&lt;/p>
&lt;h2 id="examples">
 Examples
 &lt;a class="anchor" href="#examples">#&lt;/a>
&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">POST /sales/_search
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;no_price&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;missing&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;price&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="parameters-for-missing">
 Parameters for &lt;code>missing&lt;/code>
 &lt;a class="anchor" href="#parameters-for-missing">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>field&lt;/code> &lt;br>
(Required, string) Field to check for missing values.&lt;/li>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Optional, object) Nested sub-aggregations, computed over the
documents missing the field.&lt;/li>
&lt;/ul></description></item><item><title>Sampler aggregation</title><link>/docs/references/aggregation/bucket/sampler/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/sampler/</guid><description>&lt;h1 id="sampler-aggregation">
 Sampler aggregation
 &lt;a class="anchor" href="#sampler-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A single-bucket aggregation that keeps only a sample of the matching
documents before running its sub-aggregations — used to cut aggregation
cost on very large result sets.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Sample 60 documents, then count types inside the sample:&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;sampled&amp;#34;: {
 &amp;#34;sampler&amp;#34;: { &amp;#34;shard_size&amp;#34;: 60 },
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;types&amp;#34;: { &amp;#34;terms&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;type&amp;#34;, &amp;#34;size&amp;#34;: 5 } }
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;h2 id="parameters-for-sampler">
 Parameters for &lt;code>sampler&lt;/code>
 &lt;a class="anchor" href="#parameters-for-sampler">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>shard_size&lt;/code> &lt;br>
(Optional, integer, default: &lt;code>100000&lt;/code>) Sample size per shard.&lt;/li>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Optional, object) Sub-aggregations computed over the sample.&lt;/li>
&lt;/ul></description></item><item><title>Diversified sampler aggregation</title><link>/docs/references/aggregation/bucket/diversified-sampler/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/diversified-sampler/</guid><description>&lt;h1 id="diversified-sampler-aggregation">
 Diversified sampler aggregation
 &lt;a class="anchor" href="#diversified-sampler-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>Like 
 &lt;a href="/docs/references/aggregation/bucket/sampler/">&lt;code>sampler&lt;/code>&lt;/a>, but the sample is diversified by a field
— up to one (or few) documents per value — so rare categories survive
the sampling.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Sample with at most one document per product &lt;code>type&lt;/code>: all four types
appear instead of being dominated by &lt;code>t-shirt&lt;/code>:&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;diverse&amp;#34;: {
 &amp;#34;diversified_sampler&amp;#34;: {
 &amp;#34;shard_size&amp;#34;: 60,
 &amp;#34;field&amp;#34;: &amp;#34;type&amp;#34;
 },
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;statuses&amp;#34;: { &amp;#34;terms&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;status&amp;#34;, &amp;#34;size&amp;#34;: 3 } }
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;h2 id="parameters-for-diversified_sampler">
 Parameters for &lt;code>diversified_sampler&lt;/code>
 &lt;a class="anchor" href="#parameters-for-diversified_sampler">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>shard_size&lt;/code> &lt;br>
(Optional, integer, default: &lt;code>100000&lt;/code>) Sample size per shard.&lt;/li>
&lt;li>&lt;code>field&lt;/code> &lt;br>
(Required, string) Field used to diversify the sample.&lt;/li>
&lt;li>&lt;code>max_docs_per_value&lt;/code> &lt;br>
(Optional, integer, default: &lt;code>1&lt;/code>) Documents kept per distinct value.&lt;/li>
&lt;/ul></description></item><item><title>Geo distance aggregation</title><link>/docs/references/aggregation/bucket/geo-distance-bucket/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/geo-distance-bucket/</guid><description>&lt;h1 id="geo-distance-aggregation">
 Geo distance aggregation
 &lt;a class="anchor" href="#geo-distance-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation like 
 &lt;a href="/docs/references/aggregation/bucket/range/">&lt;code>range&lt;/code>&lt;/a>, but buckets are
distance rings around a &lt;code>geo_point&lt;/code> origin.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Ring the Beijing area origin at 500 km:&lt;/p>
&lt;div class="pizza-playground" data-dataset="places" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;by_distance&amp;#34;: {
 &amp;#34;geo_distance&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;location&amp;#34;,
 &amp;#34;origin&amp;#34;: { &amp;#34;lat&amp;#34;: 39.9, &amp;#34;lon&amp;#34;: 116.4 },
 &amp;#34;ranges&amp;#34;: [
 { &amp;#34;to&amp;#34;: 500000 },
 { &amp;#34;from&amp;#34;: 500000 }
 ]
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>Two places fall inside 500 km, thirteen beyond — matching the

 &lt;a href="/docs/references/search/geo/geo_distance/">&lt;code>geo_distance&lt;/code> query&lt;/a> answer.&lt;/p></description></item><item><title>Geohash grid aggregation</title><link>/docs/references/aggregation/bucket/geohash-grid/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/geohash-grid/</guid><description>&lt;h1 id="geohash-grid-aggregation">
 Geohash grid aggregation
 &lt;a class="anchor" href="#geohash-grid-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation that groups &lt;code>geo_point&lt;/code> values into geohash
cells — the building block of map clustering.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Precision 2 (~1,250 km cells):&lt;/p>
&lt;div class="pizza-playground" data-dataset="places" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;cells&amp;#34;: {
 &amp;#34;geohash_grid&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;location&amp;#34;,
 &amp;#34;precision&amp;#34;: 2
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>Bucket keys are geohash strings (&lt;code>wt&lt;/code>, &lt;code>ws&lt;/code>, …) — render them on a map
tile layer.&lt;/p></description></item><item><title>Geotile grid aggregation</title><link>/docs/references/aggregation/bucket/geotile-grid/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/geotile-grid/</guid><description>&lt;h1 id="geotile-grid-aggregation">
 Geotile grid aggregation
 &lt;a class="anchor" href="#geotile-grid-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A multi-bucket aggregation grouping &lt;code>geo_point&lt;/code> values into
&lt;code>zoom/x/y&lt;/code> map tiles — the native grid of web maps.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Zoom 5 tiles:&lt;/p>
&lt;div class="pizza-playground" data-dataset="places" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;tiles&amp;#34;: {
 &amp;#34;geotile_grid&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;location&amp;#34;,
 &amp;#34;precision&amp;#34;: 5
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>Keys like &lt;code>5/26/13&lt;/code> address the tile at zoom 5, column 26, row 13.&lt;/p></description></item><item><title>Nested aggregation</title><link>/docs/references/aggregation/bucket/nested-agg/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/nested-agg/</guid><description>&lt;h1 id="nested-aggregation">
 Nested aggregation
 &lt;a class="anchor" href="#nested-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A single-bucket aggregation that scopes its sub-aggregations to a
nested object path. Nested field values are addressable as dotted
columns, so sub-aggregations read &lt;code>variants.color&lt;/code> style fields directly.&lt;/p>
&lt;p>&lt;code>reverse_nested&lt;/code> (only valid inside a &lt;code>nested&lt;/code> aggregation) jumps back
out to the parent-document scope.&lt;/p>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Products carry a &lt;code>variants&lt;/code> array; aggregate one value per parent
product inside the nested scope, then reverse back out:&lt;/p>
&lt;div class="pizza-playground" data-dataset="products" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;in_variants&amp;#34;: {
 &amp;#34;nested&amp;#34;: { &amp;#34;path&amp;#34;: &amp;#34;variants&amp;#34; },
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;colors&amp;#34;: { &amp;#34;terms&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;variants.color&amp;#34;, &amp;#34;size&amp;#34;: 5 } },
 &amp;#34;back_out&amp;#34;: { &amp;#34;reverse_nested&amp;#34;: {} }
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;h2 id="parameters-for-nested">
 Parameters for &lt;code>nested&lt;/code>
 &lt;a class="anchor" href="#parameters-for-nested">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>path&lt;/code> &lt;br>
(Required, string) Path of the nested object (dotted).&lt;/li>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Optional, object) Sub-aggregations in nested scope.&lt;/li>
&lt;/ul>
&lt;h2 id="parameters-for-reverse_nested">
 Parameters for &lt;code>reverse_nested&lt;/code>
 &lt;a class="anchor" href="#parameters-for-reverse_nested">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Optional, object) Sub-aggregations back in the parent scope.&lt;/li>
&lt;/ul></description></item><item><title>Children aggregation</title><link>/docs/references/aggregation/bucket/children-agg/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/children-agg/</guid><description>&lt;h1 id="children-aggregation">
 Children aggregation
 &lt;a class="anchor" href="#children-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>A single-bucket aggregation that scopes its sub-aggregations to the
child documents of a 
 &lt;a href="/docs/references/search/relational/traverse/">relation&lt;/a> field
(parent-child joins).&lt;/p>
&lt;blockquote>
&lt;p>Engine note: the current implementation runs sub-aggregations over
the scoped document set keyed by the relation; it does not resolve
per-parent child sets.&lt;/p>
&lt;/blockquote>
&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;p>Articles carry a &lt;code>related_to&lt;/code> relation; look at the relation&amp;rsquo;s child
side:&lt;/p>
&lt;div class="pizza-playground" data-dataset="articles" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;related&amp;#34;: {
 &amp;#34;children&amp;#34;: { &amp;#34;type&amp;#34;: &amp;#34;related_to&amp;#34; },
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;top_tags&amp;#34;: { &amp;#34;terms&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;tags&amp;#34;, &amp;#34;size&amp;#34;: 5 } }
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;h2 id="parameters-for-children">
 Parameters for &lt;code>children&lt;/code>
 &lt;a class="anchor" href="#parameters-for-children">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>&lt;code>type&lt;/code> &lt;br>
(Required, string) Name of the child relation to aggregate.&lt;/li>
&lt;li>&lt;code>aggs&lt;/code> &lt;br>
(Optional, object) Sub-aggregations over the child documents.&lt;/li>
&lt;/ul></description></item><item><title>Composite aggregation</title><link>/docs/references/aggregation/bucket/composite/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/aggregation/bucket/composite/</guid><description>&lt;h1 id="composite-aggregation">
 Composite aggregation
 &lt;a class="anchor" href="#composite-aggregation">#&lt;/a>
&lt;/h1>
&lt;p>Paginated multi-source bucket aggregation: the composite key is a tuple
built from several sources (a &lt;code>terms&lt;/code> field, a &lt;code>histogram&lt;/code> interval, a
&lt;code>date_histogram&lt;/code>, a &lt;code>geotile_grid&lt;/code>), and pages of buckets are pulled
with an &lt;code>after&lt;/code> cursor — the way to stream &lt;em>all&lt;/em> combinations without
oversizing &lt;code>size&lt;/code>.&lt;/p>
&lt;h2 id="examples">
 Examples
 &lt;a class="anchor" href="#examples">#&lt;/a>
&lt;/h2>
&lt;p>Page through &lt;code>merchant × day&lt;/code> combinations:&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;size&amp;#34;: 0,
 &amp;#34;aggs&amp;#34;: {
 &amp;#34;by_merchant&amp;#34;: {
 &amp;#34;composite&amp;#34;: {
 &amp;#34;size&amp;#34;: 5,
 &amp;#34;sources&amp;#34;: [
 {
 &amp;#34;m&amp;#34;: {
 &amp;#34;terms&amp;#34;: {
 &amp;#34;field&amp;#34;: &amp;#34;merchant&amp;#34;
 }
 }
 }
 ]
 }
 }
 }
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-sh" data-lang="sh">&lt;span class="line">&lt;span class="cl">POST /sales/_search
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;aggs&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;matrix&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;composite&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;size&amp;#34;&lt;/span>: 100,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;sources&amp;#34;&lt;/span>: &lt;span class="o">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;merchant&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;terms&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;merchant&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;day&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;date_histogram&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;field&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;date&amp;#34;&lt;/span>, &lt;span class="s2">&amp;#34;calendar_interval&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;day&amp;#34;&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">]&lt;/span>,
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;after&amp;#34;&lt;/span>: &lt;span class="o">{&lt;/span> &lt;span class="s2">&amp;#34;merchant&amp;#34;&lt;/span>: &lt;span class="s2">&amp;#34;shop_b&amp;#34;&lt;/span>, &lt;span class="s2">&amp;#34;day&amp;#34;&lt;/span>: &lt;span class="m">1700000000000&lt;/span> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Each response page carries an &lt;code>after_key&lt;/code>; pass it back as &lt;code>after&lt;/code> to
fetch the next page, until a page returns no &lt;code>after_key&lt;/code>.&lt;/p></description></item></channel></rss>