Skip to navigation

Delete Records By Filter

Delete every record a filter matches, records added but not yet searchable included. They leave search within about a second. dry_run: true counts the matches and deletes nothing. Repeating the call is safe.

Authentication

AuthorizationBearer

A write key, issued by Captain. Server side only. Sent as Authorization: Bearer <key>.

Path parameters

indexstringRequiredformat: "^[a-z0-9][a-z0-9_-]{0,47}$"
index name

Headers

Idempotency-KeystringOptional<=255 characters

Replays within 24 hours return the stored response (header Idempotent-Replayed: true). The same key on a different request answers 422. A concurrent duplicate answers 409. Failed requests do not keep the key.

Request

This endpoint expects an object.
filterstringRequired
a filter expression, the language search's filter takes
dry_runbooleanOptionalDefaults to false
count the matches and delete nothing

Response headers

X-Captain-Applied-Seqinteger

the last update seq search had applied when this request started; the answer reflects at least that much (GET …/updates applied_seq). Not on 401 or 403, nor for an index this server does not have

X-Captain-Index-IncarnationstringOptional

the index’s incarnation, an opaque string: it changes only when the index is deleted and created again (whose seqs start again at 1), or restored from a backup (whose seqs continue from the backup’s). Sent with X-Captain-Applied-Seq

X-Captain-Index-VersionstringOptional

the index’s version, an opaque string of at most 64 characters, read when the request started: it changes whenever what a search of this index returns can change (records applied, synonyms or rules live, another build serving, the index re-created). Sent with X-Captain-Applied-Seq

Response

dry run, or nothing matched
indexstringOptional
job_idstring or nullOptional

the write job (GET /v1/jobs/{job_id}); null when nothing was deleted

seqintegerOptional

searchable state reaches this change when applied_seq >= seq

matchedintegerOptional
deletedintegerOptional
dry_runbooleanOptional
staged_recordsintegerOptional
records the index holds after the delete
accepted_atdoubleOptional