Search vCon text
Find the vCons of a time window whose parties, subject, dialog or analysis hold a word or a pattern, with nothing indexed: turn search on, search over HTTPS and MCP, follow the cursor, and read what the audit log records.
A search finds the vCons of one tenant, first stored in a time window, whose parties, subject, dialog or analysis hold a text. The server opens each vCon of the window in memory, one at a time, matches it, and keeps nothing: no index, no cache, no file. The answer names each vCon that matched and the parts it matched in, never its text; the text is then read with a read or a reveal, which the audit log records as usual.
CI runs every command on this page against a live server, after getting started, and checks each answer.
Before you start
- A running server, set up as in getting started,
with the tenant
acme, and the certificate's copy for clients at/usr/local/share/vcon-server/ca.pem. curlandjqon the machine you search from.- Memory: the server locks all its memory (
LimitMEMLOCK, see install). A search holds one vCon at a time, decrypted and parsed. Measured peak: see Limits. - Turning search on restarts the server, so every request waits or fails for the seconds the restart takes. Nothing changes on any other system.
- One shell for every step: later steps use variables that earlier steps set.
Turn search on
Search is off until the configuration turns it on. Off, POST /vcons/search
answers 404 and the MCP tool vcon_search is not listed.
-
Set the variables, and make a key that stores and reads vCons:
CONFIG=/etc/vcon-server/vcon-server.toml URL=https://vcon.example.com:8443 CA=/usr/local/share/vcon-server/ca.pem TENANT=$(sudo -u vcon vcon-server tenant list --config $CONFIG | jq -r 'select(.name == "acme") | .id') KEY=$(sudo -u vcon vcon-server key create --tenant "$TENANT" --scope read --scope write --label search --config $CONFIG | jq -r .token) -
Add the
[search]table at the end of the configuration:printf '\n[search]\nenabled = true\n' | sudo tee -a $CONFIG >/dev/null -
Restart the server. Under systemd:
sudo systemctl restart vcon-server timeout 30 sh -c 'until curl -s -o /dev/null --cacert /usr/local/share/vcon-server/ca.pem https://vcon.example.com:8443/health; do sleep 1; done' && echo answeringansweringOr, without systemd, stop it and start it again:
sudo kill -TERM "$(pidof vcon-server)" while pidof vcon-server >/dev/null; do sleep 0.2; donesudo -u vcon vcon-server serve --config /etc/vcon-server/vcon-server.toml<time> INFO vcon_server::serve: serving listen=0.0.0.0:8443 …
Search
-
Store a vCon whose dialog holds the word
refund.SINCEis a time in whole seconds, so the command waits one second before it reads the clock: the window then starts after every vCon stored before it, even one stored earlier in the same second:sleep 1 SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ) curl -sS --cacert $CA -X POST "$URL/vcons" -H "Authorization: Bearer $KEY" \ -H 'Content-Type: application/vcon' \ --data '{"vcon":"0.4.0","uuid":"01a07da8-c2bb-83e5-b9a2-279e0d16bc90","created_at":"2026-11-24T12:00:00Z","subject":"Billing call","parties":[{"name":"Agent Example"}],"dialog":[{"type":"text","start":"2026-11-24T12:00:00Z","parties":[0],"mediatype":"text/plain","encoding":"none","body":"The refund was sent today."}]}' \ -o /dev/null -w '%{http_code}\n'201 -
Search the window from
SINCEto now forrefund. The body is JSON, so the text never appears in a URL or an access log:curl -sS --cacert $CA -X POST "$URL/vcons/search" -H "Authorization: Bearer $KEY" \ -H 'Content-Type: application/json' \ --data "{\"text\": \"refund\", \"since\": \"$SINCE\"}" | jq -c '{uuids: [.hits[].uuid], parts: .hits[0].parts, scanned, stopped}'{"uuids":["01a07da8-c2bb-83e5-b9a2-279e0d16bc90"],"parts":{"dialog":1},"scanned":1,"stopped":"end"} -
Read the dialog of the hit, as a reveal of that part:
curl -sS --cacert $CA "$URL/vcons/01a07da8-c2bb-83e5-b9a2-279e0d16bc90?reveal=dialog" -H "Authorization: Bearer $KEY" | jq -r '.dialog[0].body'The refund was sent today.
The request's fields:
| Field | Meaning | Default |
|---|---|---|
text | What to find, 1 to 256 characters | required |
match | substring, or regex for a regular expression (linear time) | substring |
case | insensitive or sensitive | insensitive |
parts | Any of parties, subject, dialog, analysis | all four |
since | Start of the window, RFC 3339, by first stored time, included | required |
until | End of the window, RFC 3339, not included | now, by the catalog's clock |
scan | vCons to scan in this call, 1 to search.max_scan | search.max_scan |
hits | Hits to answer in this call, 1 to search.max_hits | search.max_hits |
cursor | The next of an earlier answer, to go on | none |
The catalog's clock is the one the stored times are kept by. With a
PostgreSQL catalog it is the database server's clock, so a vCon that another
server stored a moment ago is inside a window without until, even when this
host's clock is behind. With a data directory it is this server's clock.
An answer that stops before the window's end (stopped is scan, hits,
bytes or time) carries next: send the same request again with cursor
set to it.
Search over MCP
The MCP tool vcon_search takes the same fields as its arguments and
answers the same object. Connect an MCP client shows
how to call a tool.
The tool's answer is held to mcp.response_bytes (1 MiB by default): it
answers at most as many hits as fit at their longest, 278 bytes each after
302 bytes for the rest of the answer, and stops with stopped: "bytes" and
next when its unreadable uuids would pass the budget. With search on, the
server does not start with mcp.response_bytes under 580 bytes.
Verify
The tenant's audit log holds one search record for the search, whose
target is the window, and one search_hit record for each hit, under the
hit's version. The text searched for is in no record.
AUDIT=$(sudo -u vcon vcon-server key create --tenant "$TENANT" --scope audit --label search-audit --config $CONFIG | jq -r .token)
curl -sS --cacert $CA "$URL/audit" -H "Authorization: Bearer $AUDIT" | jq -c 'select(.action == "search" or .action == "search_hit") | {action, status}'
{"action":"search_hit","status":200}
{"action":"search","status":200}
What is matched
- Parties:
name,tel,mailto,sipanddid. - The subject.
- Dialog and analysis bodies held in the vCon: text as it is; a body of
encoding
json, its string values (never its keys); abase64urlbody only when its media type istext/*orapplication/json. - A signed vCon's payload.
Never matched: content held at a url (a search makes no request), audio,
video and images, attachments, extensions, a reference to another vCon
(redacted, appended, amended), deleted and older versions, and an
encrypted (JWE) vCon, which is counted in skipped.encrypted.
Case-insensitive matching lowers both sides (Unicode lower case, not full
case folding: ß does not match SS). A regular expression's case: insensitive is ASCII only.
Limits
| Key | Meaning | Default | Most |
|---|---|---|---|
search.max_window_days | Longest window, in days | 31 | 366 |
search.max_scan | vCons one call scans | 1000 | 10000 |
search.max_hits | Hits one call answers | 100 | 1000 |
search.max_bytes | Decrypted bytes one call reads | 268435456 | 1073741824 |
search.max_vcon_bytes | Largest vCon a search reads, inflated; larger ones are counted in skipped.too_large | 16777216 | limits.inflated |
search.max_seconds | Longest one call runs | 5 | 30 |
search.per_key_per_minute | Searches one key may make in a minute | 6 | 600 |
search.per_tenant_per_minute | Searches one tenant's keys may make in a minute | 30 | 6000 |
search.concurrent | Searches running at once on the server; a tenant runs one | 2 | the host's cores |
Measured peak memory of one search: a release build on aarch64 Linux, with
one stored vCon of 16,773,120 bytes whose dialog text held the term at its
end, rose from 71 MiB at rest to 119 MiB during the search, a peak 48 MiB
higher, about three times the vCon's size (three runs, each within 1 MiB).
A search holds one vCon at a time, so on a host short of memory, lower
search.max_vcon_bytes.
When a step fails
404fromPOST /vcons/search: search is off. Check the[search]table and restart.400,bad-query: a field is missing or out of range: nosince, a window longer thansearch.max_window_days,untilnot aftersince, a text empty or over 256 characters, a regular expression that does not compile or is too large, or an unknown field.429,search-limited: the key or the tenant made its searches for this minute. Wait theRetry-Afterseconds.503,search-busy: a search of the same tenant, orsearch.concurrentsearches, are running.stoppedistimewith objects in S3: each vCon is one request to the bucket. Narrow the window, or follownext.- A uuid in
unreadable: that vCon's object did not open. Runvcon-server check(see operations).
Source of this page: website/content/docs/search-text.md