client.session(name), then add,
query, and delete documents locally; embedding and search run on-device, with no network
call per operation. When you are done, push_index() persists the index to the cloud.
A session is represented by a SessionIndex.
Operations
add_docs(docs, options?)- embeds and indexes documents locally; returns(added, updated).query(text, options?)- semantic or hybrid search over the in-memory index; returns aSearchResult.get_docs(options?)/delete_docs(ids)- read and remove documents locally.push_index()- uploads the session to the cloud, creating or replacing the cloud index of the same name. For a built-in model the service re-embeds the text with that model; a custom-model session keeps its own embeddings.
session(name) is create-or-resume:
if a cloud index with that name already exists it is loaded into the session (no
re-embedding); otherwise the session starts empty. A JavaScript session always starts empty;
call session.loadIndex(name) to resume the cloud index. The rest of the API is the same
either way.
Example
Performance characteristics
- Operations run in-process: no network round trip, TLS, or serialization on the query path.
- Query text is embedded by a local model; with
model_id="custom"you supply the query vector viaQueryOptions.embeddinginstead. - Local queries typically complete in single-digit milliseconds, which suits short, frequent queries against a per-session or per-user working set.
Session vs. loaded cloud index
The two compose: load a persistent index and open a session in the same client. See
Live-call context.
Related
Sessions guide
The full session lifecycle and API.
SessionIndex reference
Methods, parameters, and return types.