Streaming #
Search on Pizza is real-time — documents are visible the moment they are
written. The stream 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.
POST /my-collection/_search
Example #
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
curlagainst a live server to watch chunks arrive incrementally.
{
"query": { "match": { "field": "message", "query": "error" } },
"size": 0,
"stream": {
"mode": "progressive",
"buffer_size": 4,
"max_wait_ms": 250
}
}
Parameters #
mode
(Required,batch|progressive|threshold) Delivery mode:batch— normal one-shot search; the block only configures timing.progressive— flush partial results as the query makes progress, then keep pushing newly matching documents.threshold— hold results back until a score threshold or wait budget is met, trading freshness for stability.
buffer_size
(Optional, integer, default:4) Micro-batching of pushed hits — more is cheaper per hit, less is lower latency.score_threshold
(Optional, float) Inthresholdmode, the score a hit must reach before the buffer flushes.max_wait_ms
(Optional, integer) Upper bound on how long a partially filled buffer may wait before flushing regardless.aggs_priority
(Optional,normal|low|deferred) Whether aggregations in the same request block streaming delivery.deferredships hits first and fills in aggregation results later.
Notes #
- Streaming interacts with realtime visibility: a hit can arrive in the same request that indexed it — there is no refresh interval to wait for.
- Cursors (
search_after) combine with streaming for durable consumption; the change feed is the complementary write-path stream (CDC). - Keep
buffer_sizesmall for alerting-style consumers and large for dashboard-style consumers.