Skip to navigation

Create Index

Create an empty index. Name it, and optionally give field types. Fields left out are typed from the first records added. Then add records to it.

Authentication

AuthorizationBearer

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

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.
namestringRequiredformat: "^[a-z0-9][a-z0-9_-]{0,47}$"
id_fieldstringOptionalDefaults to id

field holding each record’s unique id (objectID is accepted when this is id)

fieldsmap from strings to objectsOptional
optional field types, by field name. A field left out is typed from the first records added. The same as settings.fields
expected_recordsintegerOptional0-1000000000

how many records this index will hold: the tenant’s capacity forecast counts it at once, so a resize can start before the upload lands (real records take over once they pass it)

expected_bytesintegerOptional0-10000000000000
the source JSON those records will total, for the same forecast

Response

created
namestringOptional
the index name
id_fieldstringOptional

Create Index only: the field that holds each record’s id

statusenumOptional

empty: no records yet. pending: changes were accepted and are being applied. building: Captain is refreshing suggestions and spelling in the background, and search serves as usual. ready: every change is applied.

Allowed values:
record_countintegerOptional
Records the index holds, built or not.
staged_recordsintegerOptional

the same value as record_count, under its older name

staged_documentsintegerOptional

the same value as record_count, under its older name

pending_changesbooleanOptional
True while accepted changes are still being applied.
staged_changes_since_buildbooleanOptional

the same value as pending_changes, under its older name

build_idstring or nullOptional

the build search serves; null before the first one

last_jobstring or nullOptional
the id of the index's latest job, for Get Job
last_build_atinteger or nullOptional

unix seconds the serving build finished; null when nothing is served, or for a build whose finish time was not recorded

created_atintegerOptional
unix seconds
servingobject or nullOptional
The build search is serving, and how many records it holds.