- The numbers are the engine’s.
p,distandscoreare the engine’s raw output. Once a judgment has 100 outcomes, each answer also carries acalibratedobject with the same fields plusmethod,outcomesandfrom_previous_epoch. It never replaces the raw fields, and thresholds, filters and ranking use the raw fields. See calibration. - A composite judgment’s
pis combined. It comes from weights fitted on your labels, andpartsgives each part’s rawp. It has nocalibratedobject, and thresholds, filters and ranking use the combinedp. - Every answer has provenance. It names the document
revisionit was computed for, thejudgment_version, theengine_versionand theevaluation_id, so you can always see how it was produced. When a change leaves the compiled context the same, the answer is reused for the new revision without calling the engine:revisionmoves on, andevaluation_idandevaluated_atstill name the earlier evaluation that computed the numbers. - The answer of a judgment with relations has a
watermark, the position in the namespace’s log its context was read at. Every write at or below it, to the document or to the documents that point at it, is reflected.revisionstill names the document’s own revision. For a relation that reads the document the judged one points at, the watermark also says which version of that document the answer read; an answer outside the judgment’s re-judge scope keeps that version after the document changes. On a get, such an answer also listsreferenced_changes: the newest write to each document it points at that changed what the relation shows, with itsrevisionand time. One at or below the watermark is in the answer; one above it leaves the answerfreshonly when the document is outside the scope. Afailedanswer of such a judgment keeps its last good numbers but has nowatermark, because the failed attempt’s position does not describe them. A judgment withapplies_tohas no answer at all for the documents it does not apply to. - Every answer has a freshness.
staleandfailedanswers still carry the last good numbers and the revision they were computed for.
Querying answers
Queries filter and rank on answers like any other field:- Filters are
[field, op, value],["And" | "Or", [...]]or["Not", filter]. The operators areEq,NotEq,In,NotIn,Lt,Lte,Gt,Gte,Glob,Contains(on string arrays) andExists. - Filterable fields are
id,revision,updated_at,attributes.*, and for each judgmentp,value,score,dist.{option},escape_p,freshnessandthresholds.{name}.stateis never filterable. rank_byis one field and a direction,["updated_at", "desc"]by default.top_kis at most 1,000. Acursorfromnext_cursorfetches the next page. Cursors last 10 minutes and pin the namespace’s state, so pages are consistent with each other.more: truemeans more rows matched.answers: "fresh_only"drops rows whose included answers are notfresh.consistency: "eventual"may serve a view of the namespace up to 60 seconds old, for lower latency.- A query whose estimated scan is over 4 GB is refused with
too_largeand the estimate, and is not billed. Add attribute filters to narrow it.
on_change policy, because the query needs every answer to exist. Using an on_read judgment in a filter returns invalid_request; switch it to on_change first, which backfills the missing answers after you confirm an estimate. Vainona never backfills silently.