Skip to main content
A query finds the documents whose answers meet your conditions: filter, sort and rank on answers as on any other field, read only answers that are current, and find the answers that one version of a judgment or engine made. You can also act only where the corrected number is high with 95% confidence, on a judgment with features. This query finds the payments that have a settles pick, lowest escape_p first, and reads current answers only.
POST /v1/namespaces/acme%2Fprod/query
  • settles matches a payment to an open invoice (match one record to another). Its unmatched threshold is true when escape_p (the probability of no match) is at least 0.3, so this filter keeps the payments with a pick.
  • escape_p, value and the threshold are the fitted numbers when settles has features and a fit, so a new fit can move a payment in or out of this query and change its pick.
  • Each row has its id, its revision, the block attribute and the settles answer. "state": true adds each row’s state, and "images": true its images, as references.

Filters

A filter is [field, op, value], ["And", [...]], ["Or", [...]] or ["Not", filter]. The operators are Eq, NotEq, In, NotIn, Lt, Lte, Gt, Gte, Glob, Contains (on arrays of strings) and Exists. A comparison on a missing field is false, except NotEq and NotIn, which are true, so ["answers.settles.value", "NotEq", "none_of_the_above"] also matches payments with no answer yet. Add ["answers.settles.value", "Exists", true] to leave them out.

Fields you can filter on

You can filter on id, revision, updated_at and attributes.*, never on state, and on these fields of each judgment’s answer, as answers.<j>.<field>: A text column takes value, a json column the keys under value, and an embedding column none of its value; each takes freshness, judgment_version, engine and engine_version. Any other field of these types, and a key of a decision’s value, is invalid_request. Each filter reads the number that the answer shows, which is the engine’s number on a judgment without features (never calibrated), the fitted number on a judgment with features, and the combined p on a composite. See which number your thresholds and queries read.

Filter on how sure a calibrated number is

fit.interval is the 95% interval of the fitted p on a judgment with features (on a choice, escape_p; on a score, score), and interval.lower and interval.upper are its bounds. You can compare them with numbers (Eq, NotEq, Lt, Lte, Gt, Gte, In, NotIn), test them with Exists, or rank on them. To act only where the probability is surely high, filter on the lower bound rather than on p.
  • The bounds read the same fit as p, in the same read.
  • The bounds are missing while p is the engine’s (which includes every judgment with features below 100 outcomes) and for a fit made before fits recorded intervals. ["answers.invoice_settlement.interval.lower", "Exists", false] selects those documents.
  • The bounds are invalid_request on a judgment without features, since the corrected numbers there are for reading only. Read calibrated.interval in your own code, or pick a threshold with the recommender.
  • A query always reads the current bounds, which change when the fit changes and can narrow as outcomes arrive.
See automate on the bound.

Find the answers of one version

judgment_version, engine and engine_version find the answers that one version of the judgment, one engine, or one engine version made. After you activate version 4 of settles, this filter finds the answers that versions 1 to 3 made.
  • judgment_version is an integer. Compare it with Eq, NotEq, Lt, Lte, Gt, Gte, In or NotIn, or test it with Exists.
  • engine is a string, such as jev or gpt-6-luna. Compare it with Eq, NotEq, In or NotIn, or test it with Exists.
  • engine_version is a string, compared the same way. For an engine version that is not pinned (jev current, for example), it holds the label of the epoch, such as current+2026-09-24.1. Each engine numbers its own epochs, so two engines can share a label and you filter on engine too.
You can also rank on these fields. An answer from an earlier judgment version reads stale, with stale_reason older_version. A new epoch never makes an answer stale, however. To compare two epochs, filter on engine_version. See versions.

Filter on a feature

A feature filter names the judgment and the feature. If invoice_settlement keeps matched_payments.count, this filter finds the invoices with two or more matched payments.
  • All the text after features. is the feature’s name, and it must be a feature of that judgment.
  • Compare it with numbers (Eq, NotEq, Lt, Lte, Gt, Gte, In, NotIn), or test it with Exists.
  • The filter reads the value stored with the answer, which follows the related documents after the judgment’s debounce. If freshness matters, also check the answer’s freshness. A window counts back from the document’s newest activity rather than from today.

Read only current answers

Each answer has a freshness, which a query uses in two ways:
  • answers: "fresh_only" removes each row whose included answers are not fresh. It checks only the judgments that include.answers names, and also removes a row with no answer for one of them.
  • A filter on freshness reads one judgment’s freshness, such as ["answers.settles.freshness", "Eq", "fresh"].
Both leave out an answer from an earlier judgment version, because it reads stale. A fresh_only query on an on_read judgment reads the rows it leaves out, so Brussle judges them again as it does the rows it returns. A later query returns each row once its answer is fresh. One query starts this judging for at most top_k left-out rows per judgment (among rows that match the rest of the query), so a “current answers only” queue refills a page at a time after a version switch. A filter on pending tells you whether a judgment has caught up with your writes, since a query for one pending answer returns no row when it has. A judgment’s judged_through tells you too, and reads no documents. See is a judgment caught up?.

Rank and page

  • rank_by is one field and a direction, ["updated_at", "desc"] by default, and ties go by id.
  • top_k is at most 1,000, and more: true means more rows matched.
  • cursor gets the next page when you send the previous page’s next_cursor. A cursor lasts 10 minutes and keeps the namespace as it was at the first page, so all pages agree.
  • consistency: "eventual" can serve a view up to 60 seconds old for lower latency, while the default, strong, sees every write acknowledged before the query.
  • Large scans are refused. Brussle refuses a query whose estimated scan is more than 4 GB with too_large and the estimate, and does not bill it. Add attribute filters to narrow it.
  • A filter or rank on a json key reads each answer it compares. Brussle refuses one that would read more than 256 MB of json answers with too_large and the estimate, and does not bill it. Add attribute filters to narrow it. A query that only returns a json or embedding answer reads its value, and one that neither returns nor filters on it does not.
Some filters read every document in the namespace (a filter on pending, for example). See tradeoffs for which filters are fast.

Which judgments you can filter on

You can filter or rank on any judgment except an on_read one.
  • An on_read answer exists only after something reads it, so a filter on it is invalid_request. Switch the judgment to on_change first, and Brussle backfills the missing answers once you confirm an estimate, never without one.
  • on_change keeps each answer current, so use it for the judgments you filter on.
  • Filters read periodic and manual answers as they are stored.

Read one document

GET /namespaces/{ns}/documents/{id} returns one document with all its answers, and their history on request. See reading documents.

Count answers per group

A query returns documents, so to count answers per key value (the matched payments for each customer each month, for example), declare a group. A group keeps counts, sums and averages over documents and answers for each key value, and you read its rows when you want them.

Get told when a document matches

A subscription is a saved query that sends an event when a document starts or stops matching its filter. Its filter uses the same grammar as a query’s filters, except freshness.