<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Request-level options on INFINI Pizza</title><link>/docs/references/search/request/</link><description>Recent content in Request-level options on INFINI Pizza</description><generator>Hugo</generator><language>en</language><atom:link href="/docs/references/search/request/index.xml" rel="self" type="application/rss+xml"/><item><title>Sort and pagination</title><link>/docs/references/search/request/sort/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/search/request/sort/</guid><description>&lt;h1 id="sort-and-pagination">
 Sort and pagination
 &lt;a class="anchor" href="#sort-and-pagination">#&lt;/a>
&lt;/h1>
&lt;p>Control which documents come back and in what order — &lt;code>sort&lt;/code>, &lt;code>from&lt;/code>/&lt;code>size&lt;/code>,
&lt;code>search_after&lt;/code>/&lt;code>search_before&lt;/code>, and total-hit accounting.&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">POST /my-collection/_search
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="sort">
 Sort
 &lt;a class="anchor" href="#sort">#&lt;/a>
&lt;/h2>
&lt;p>&lt;code>sort&lt;/code> is an array of sort clauses evaluated in order; the first clause that
produces a difference decides the order.&lt;/p>
&lt;div class="pizza-playground" data-dataset="sales" data-dsl="{
 &amp;#34;query&amp;#34;: { &amp;#34;match_all&amp;#34;: {} },
 &amp;#34;sort&amp;#34;: [
 { &amp;#34;field&amp;#34;: &amp;#34;date&amp;#34;, &amp;#34;order&amp;#34;: &amp;#34;desc&amp;#34;, &amp;#34;missing&amp;#34;: &amp;#34;last&amp;#34; },
 { &amp;#34;field&amp;#34;: &amp;#34;price&amp;#34;, &amp;#34;order&amp;#34;: &amp;#34;asc&amp;#34; }
 ],
 &amp;#34;size&amp;#34;: 3,
 &amp;#34;track_total_hits&amp;#34;: true
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;h3 id="parameters">
 Parameters
 &lt;a class="anchor" href="#parameters">#&lt;/a>
&lt;/h3>
&lt;ul>
&lt;li>&lt;code>field&lt;/code> &lt;br>
(Required, string) The field to sort by. Two pseudo-fields are always
available: &lt;code>_score&lt;/code> (relevance, descending by default) and &lt;code>_doc&lt;/code> (index
order — the cheapest possible sort).&lt;/li>
&lt;li>&lt;code>order&lt;/code> &lt;br>
(Optional, &lt;code>asc&lt;/code> | &lt;code>desc&lt;/code>) Sort direction. When omitted the engine sorts
descending for &lt;code>_score&lt;/code> and ascending for regular fields.&lt;/li>
&lt;li>&lt;code>missing&lt;/code> &lt;br>
(Optional, &lt;code>first&lt;/code> | &lt;code>last&lt;/code>; the gateway also accepts the Elasticsearch
spellings &lt;code>_first&lt;/code> / &lt;code>_last&lt;/code>) Where documents without a value for the
field land, independent of the sort direction. Default: &lt;code>last&lt;/code>.
Documents whose keys tie (including two missing values) break the tie
by internal doc order, so pages are repeatable.&lt;/li>
&lt;/ul>
&lt;p>Sorting on an indexed field lets the engine skip documents that cannot make
the cut (early termination); &lt;code>&amp;quot;_doc&amp;quot;&lt;/code> and index-time sorted fields
(see 
 &lt;a href="/docs/references/schema/field-parameters/">field parameters&lt;/a>) are the fastest.&lt;/p></description></item><item><title>Highlighting</title><link>/docs/references/search/request/highlight/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/search/request/highlight/</guid><description>&lt;h1 id="highlighting">
 Highlighting
 &lt;a class="anchor" href="#highlighting">#&lt;/a>
&lt;/h1>
&lt;p>Ask for matched fragments of your text fields back alongside each hit, with
the matched terms wrapped in tags — ready to render as a search result list.&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">POST /my-collection/_search
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&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="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;query&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span> &lt;span class="nt">&amp;#34;match&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span> &lt;span class="nt">&amp;#34;field&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;message&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nt">&amp;#34;query&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;search&amp;#34;&lt;/span> &lt;span class="p">}&lt;/span> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;highlight&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;fields&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;message&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;fragment_size&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">100&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;number_of_fragments&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">3&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;size&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">5&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="pizza-playground" data-dataset="logs" data-dsl="{
 &amp;#34;query&amp;#34;: { &amp;#34;match&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;message&amp;#34;, &amp;#34;query&amp;#34;: &amp;#34;search&amp;#34; } },
 &amp;#34;highlight&amp;#34;: {
 &amp;#34;fields&amp;#34;: {
 &amp;#34;message&amp;#34;: {
 &amp;#34;fragment_size&amp;#34;: 100,
 &amp;#34;number_of_fragments&amp;#34;: 3
 }
 }
 },
 &amp;#34;size&amp;#34;: 3
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>Each returned hit carries a &lt;code>highlight&lt;/code> object whose keys are the requested
fields; values are fragment strings with matched terms wrapped in the tags
(default &lt;code>&amp;lt;em&amp;gt;&lt;/code> … &lt;code>&amp;lt;/em&amp;gt;&lt;/code>). Custom tags — same idea with &lt;code>&amp;lt;b&amp;gt;&lt;/code> wrapping:&lt;/p></description></item><item><title>Hybrid search and scoring pipeline</title><link>/docs/references/search/request/hybrid/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/search/request/hybrid/</guid><description>&lt;h1 id="hybrid-search-and-scoring-pipeline">
 Hybrid search and scoring pipeline
 &lt;a class="anchor" href="#hybrid-search-and-scoring-pipeline">#&lt;/a>
&lt;/h1>
&lt;p>Pizza runs lexical (BM25) and vector retrieval side by side and gives you
explicit, composable stages to combine and re-shape scores:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">retrieve → fuse → score_functions → rescore
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">(parallel (merge (function (second pass
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> retrievers) the lists) scoring) on the top window)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Every stage is optional and combines with a plain &lt;code>query&lt;/code>: use
&lt;code>score_functions&lt;/code> alone on a keyword search, or the full chain for
hybrid retrieval.&lt;/p></description></item><item><title>Field collapsing</title><link>/docs/references/search/request/collapse/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/search/request/collapse/</guid><description>&lt;h1 id="field-collapsing">
 Field collapsing
 &lt;a class="anchor" href="#field-collapsing">#&lt;/a>
&lt;/h1>
&lt;p>Collapse the result list so each distinct value of a field appears at most
once — &amp;ldquo;best product per merchant&amp;rdquo;, &amp;ldquo;best article per author&amp;rdquo; — without a
terms aggregation, keeping full hit semantics (scores, source, highlight).&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">POST /my-collection/_search
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&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;query&amp;#34;: { &amp;#34;match_all&amp;#34;: {} },
 &amp;#34;collapse&amp;#34;: { &amp;#34;field&amp;#34;: &amp;#34;type&amp;#34; },
 &amp;#34;size&amp;#34;: 4,
 &amp;#34;track_total_hits&amp;#34;: true
}">
 &lt;noscript>JavaScript is disabled — use the curl form of this example instead.&lt;/noscript>
&lt;/div>
&lt;p>One best-selling hit per product type (the dataset has four: &lt;code>hat&lt;/code>,
&lt;code>t-shirt&lt;/code>, &lt;code>mug&lt;/code>, &lt;code>sticker&lt;/code>); the plain match-all total stays 120 —
collapse deduplicates the RESULT list, not the count.&lt;/p></description></item><item><title>Streaming search</title><link>/docs/references/search/request/streaming/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/docs/references/search/request/streaming/</guid><description>&lt;h1 id="streaming">
 Streaming
 &lt;a class="anchor" href="#streaming">#&lt;/a>
&lt;/h1>
&lt;p>Search on Pizza is real-time — documents are visible the moment they are
written. The &lt;code>stream&lt;/code> block makes a single search request behave like a
subscription: the engine keeps the query warm and pushes fresh hits as they
land, instead of making the client poll.&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">POST /my-collection/_search
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="example">
 Example
 &lt;a class="anchor" href="#example">#&lt;/a>
&lt;/h2>
&lt;blockquote>
&lt;p>This page has no live playground demo: the response body here is a
live HTTP stream (chunked, newline-delimited hits), while the in-page
widget executes one-shot queries against a WebAssembly engine and
renders a complete JSON result. Run the example with &lt;code>curl&lt;/code> against a
live server to watch chunks arrive incrementally.&lt;/p></description></item></channel></rss>