Data-plane vector operations on an index host (the host from
::pinecone::indexes/describe-index): upsert, query, fetch, update,
list IDs, delete, and index stats. Every call targets the default
namespace unless you pass one; the namespace forms take it
explicitly so a record written to a namespace can be read back
from it.
Values
MAX_LIST_PAGES
MAX_LIST_PAGES: Int 1000
Functions
build-update-body
fn (id: Str, changes: Map, namespace: Any): Map
The POST /vectors/update body for one vector: id, the set fields of
changes (values, sparseValues, setMetadata), and namespace
when given. Exposed for testing.
Example
::pinecone::vectors/build-update-body("doc-1", {setMetadata: {reviewed: true}}, null) // {id: "doc-1", setMetadata: {reviewed: true}}
collect-ids
fn (fetch-page: Fn, token: Any): Vec
Gather IDs across pages: calls fetch-page(token) (token null for the
first page) until a page has no pagination.next. An Err from
fetch-page is returned. Exposed for testing.
Example
fetch-page (token) { if(is-null(token), {vectors: [{id: "a"}], pagination: {next: "p2"}}, {vectors: [{id: "b"}]}) }
::pinecone::vectors/collect-ids(fetch-page, null) // ["a", "b"]
delete-vectors
fn (host: Str, options: Map): Map
fn (host: Str, options: Map, opts: Map): Map
POST {host}/vectors/delete - Delete by ids ({ids: [...]}, up to 1000),
by metadata filter ({filter: {...}}), or everything in a namespace
({deleteAll: true}). Add namespace to target one. Returns {}.
Example
host ::pinecone::indexes/describe-index("docs").host
::pinecone::vectors/delete-vectors(host, {ids: ["doc-1", "doc-2"], namespace: "guides"})
pinecone.api.key
describe-stats
fn (host: Str): Map
fn (host: Str, filter: Map): Map
fn (host: Str, filter: Map?, opts: Map): Map
POST {host}/describe_index_stats - Vector counts per namespace,
dimension, metric, totalVectorCount, and fullness. The 2-arity
form counts only vectors matching a metadata filter (pod-based
indexes).
Example
host ::pinecone::indexes/describe-index("docs").host
stats ::pinecone::vectors/describe-stats(host)
stats.totalVectorCount
pinecone.api.key
fetch
fn (host: Str, ids: Vec): Map
fn (host: Str, ids: Vec, namespace: Str): Map
fn (host: Str, ids: Vec, opts: Map): Map
fn (host: Str, ids: Vec, namespace: Str?, opts: Map): Map
GET {host}/vectors/fetch - Fetch up to 1000 vectors by id, from the
default namespace or namespace. Returns {vectors: {id: {id, values, metadata?}}, namespace, usage}.
Example
host ::pinecone::indexes/describe-index("docs").host
out ::pinecone::vectors/fetch(host, ["doc-1", "doc-2"], "guides")
get(out.vectors, "doc-1")
pinecone.api.key
fetch-by-metadata
fn (host: Str, filter: Map, options: Map): Map
fn (host: Str, filter: Map, options: Map, opts: Map): Map
POST {host}/vectors/fetch_by_metadata - Fetch vectors matching a
metadata filter. options: namespace, limit (default 100),
paginationToken. Returns {vectors, pagination?: {next}}.
Example
host ::pinecone::indexes/describe-index("docs").host
out ::pinecone::vectors/fetch-by-metadata(host, {source: {"$eq": "guide.md"}}, {namespace: "guides", limit: 50})
keys(out.vectors)
pinecone.api.key
fetch-url
fn (host: Str, ids: Vec, namespace: Any): Str
The GET /vectors/fetch URL: one ids= parameter per id (URL-encoded),
plus namespace when given. Exposed for testing.
Example
::pinecone::vectors/fetch-url("docs-abc.svc.pinecone.io", ["a", "b"], "guides") // "https://docs-abc.svc.pinecone.io/vectors/fetch?ids=a&ids=b&namespace=guides"
list-all-ids
fn (host: Str): Vec
fn (host: Str, options: Map): Vec
fn (host: Str, options: Map, opts: Map): Vec
Every vector ID matching options (as list-ids), following
pagination.next across pages. Returns a Vec of ID strings.
Example
host ::pinecone::indexes/describe-index("docs").host
ids ::pinecone::vectors/list-all-ids(host, {prefix: "doc-1#", namespace: "guides"})
::pinecone::vectors/delete-vectors(host, {ids: ids, namespace: "guides"})
pinecone.api.key
list-ids
fn (host: Str): Map
fn (host: Str, options: Map): Map
fn (host: Str, options: Map, opts: Map): Map
GET {host}/vectors/list - One page of vector IDs (serverless
indexes). options: prefix (match IDs that start with it),
limit (1-100, default 100), paginationToken, namespace.
Returns {vectors: [{id}], pagination?: {next}}; pass
pagination.next back as paginationToken for the next page, or
use list-all-ids.
Example
host ::pinecone::indexes/describe-index("docs").host
page ::pinecone::vectors/list-ids(host, {prefix: "doc-", limit: 50, namespace: "guides"})
map(page.vectors, %.id)
pinecone.api.key
list-ids-url
fn (host: Str, options: Map): Str
The GET /vectors/list URL from the set options among prefix, limit
(1-100), paginationToken, namespace. Exposed for testing.
Example
::pinecone::vectors/list-ids-url("docs-abc.svc.pinecone.io", {limit: 10}) // "https://docs-abc.svc.pinecone.io/vectors/list?limit=10"
query
fn (host: Str, options: Map): Map
fn (host: Str, options: Map, opts: Map): Map
POST {host}/query - Nearest-neighbor search. options: vector (or
id to query by an existing vector, or sparseVector), topK
(default 10, max 10000), namespace, filter (metadata filter with
$eq/$in/$gte/...), includeMetadata, includeValues.
Returns {matches: [{id, score, metadata?, values?}], namespace, usage}.
Example
host ::pinecone::indexes/describe-index("docs").host
out ::pinecone::vectors/query(host, {
vector: [0.1, 0.2, 0.3],
topK: 3,
namespace: "guides",
includeMetadata: true,
filter: {source: {"$eq": "guide.md"}}
})
map(out.matches, %.id)
pinecone.api.key
update
fn (host: Str, id: Str, changes: Map): Map
fn (host: Str, id: Str, changes: Map, namespace: Str): Map
fn (host: Str, id: Str, changes: Map, opts: Map): Map
fn (host: Str, id: Str, changes: Map, namespace: Str?, opts: Map): Map
POST {host}/vectors/update - Change one vector in place. changes:
values (replaces the dense values), sparseValues, setMetadata
(merged into existing metadata). The 4-arity form targets a
namespace. Returns {}.
Example
host ::pinecone::indexes/describe-index("docs").host
::pinecone::vectors/update(host, "doc-1", {setMetadata: {reviewed: true}}, "guides")
pinecone.api.key
update-by-filter
fn (host: Str, filter: Map, set-metadata: Map, options: Map): Map
fn (host: Str, filter: Map, set-metadata: Map, options: Map, opts: Map): Map
POST {host}/vectors/update - Merge set-metadata into every vector
matching filter. options: namespace, dryRun (count matches
without writing). Returns {matchedRecords}.
Example
host ::pinecone::indexes/describe-index("docs").host
// Count the matches first with dryRun
out ::pinecone::vectors/update-by-filter(host, {source: {"$eq": "guide.md"}}, {archived: true}, {namespace: "guides", dryRun: true})
out.matchedRecords
pinecone.api.key
upsert
fn (host: Str, vectors: Vec): Map
fn (host: Str, vectors: Vec, namespace: Str): Map
fn (host: Str, vectors: Vec, opts: Map): Map
fn (host: Str, vectors: Vec, namespace: Str?, opts: Map): Map
POST {host}/vectors/upsert - Write up to 1000 vectors:
[{id, values, metadata?, sparseValues?}]. The 3-arity form targets
a namespace. Returns {upsertedCount}.
Example
host ::pinecone::indexes/describe-index("docs").host
out ::pinecone::vectors/upsert(host, [
{id: "doc-1", values: [0.1, 0.2, 0.3], metadata: {source: "guide.md"}}
], "guides")
out.upsertedCount
pinecone.api.key