vcon-server

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.
  • curl and jq on 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.

  1. 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)
    
  2. Add the [search] table at the end of the configuration:

    printf '\n[search]\nenabled = true\n' | sudo tee -a $CONFIG >/dev/null
    
  3. 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 answering
    
    answering
    

    Or, without systemd, stop it and start it again:

    sudo kill -TERM "$(pidof vcon-server)"
    while pidof vcon-server >/dev/null; do sleep 0.2; done
    
    sudo -u vcon vcon-server serve --config /etc/vcon-server/vcon-server.toml
    
    <time>  INFO vcon_server::serve: serving listen=0.0.0.0:8443
    …
    
  1. Store a vCon whose dialog holds the word refund. SINCE is 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
    
  2. Search the window from SINCE to now for refund. 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"}
    
  3. 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:

FieldMeaningDefault
textWhat to find, 1 to 256 charactersrequired
matchsubstring, or regex for a regular expression (linear time)substring
caseinsensitive or sensitiveinsensitive
partsAny of parties, subject, dialog, analysisall four
sinceStart of the window, RFC 3339, by first stored time, includedrequired
untilEnd of the window, RFC 3339, not includednow, by the catalog's clock
scanvCons to scan in this call, 1 to search.max_scansearch.max_scan
hitsHits to answer in this call, 1 to search.max_hitssearch.max_hits
cursorThe next of an earlier answer, to go onnone

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, sip and did.
  • 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); a base64url body only when its media type is text/* or application/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

KeyMeaningDefaultMost
search.max_window_daysLongest window, in days31366
search.max_scanvCons one call scans100010000
search.max_hitsHits one call answers1001000
search.max_bytesDecrypted bytes one call reads2684354561073741824
search.max_vcon_bytesLargest vCon a search reads, inflated; larger ones are counted in skipped.too_large16777216limits.inflated
search.max_secondsLongest one call runs530
search.per_key_per_minuteSearches one key may make in a minute6600
search.per_tenant_per_minuteSearches one tenant's keys may make in a minute306000
search.concurrentSearches running at once on the server; a tenant runs one2the 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

  • 404 from POST /vcons/search: search is off. Check the [search] table and restart.
  • 400, bad-query: a field is missing or out of range: no since, a window longer than search.max_window_days, until not after since, 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 the Retry-After seconds.
  • 503, search-busy: a search of the same tenant, or search.concurrent searches, are running.
  • stopped is time with objects in S3: each vCon is one request to the bucket. Narrow the window, or follow next.
  • A uuid in unreadable: that vCon's object did not open. Run vcon-server check (see operations).

Source of this page: website/content/docs/search-text.md