Data-plane document operations for a schema-based index. Access via pc.preview.index('index-name').

import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();

const index = pc.preview.index('my-schema-index');
await index.upsertDocuments('my-namespace', {
documents: [{ _id: 'doc-1', chunk_text: 'Hello world' }],
});

Uses Pinecone API version 2026-01.alpha. Preview surface is not covered by SemVer — signatures and behavior may change in any minor SDK release. Pin your SDK version when relying on preview features.

Constructors

Methods

  • Alpha

    Deletes documents from a namespace by their IDs, or deletes all documents in the namespace.

    Exactly one of ids or deleteAll must be set.

    Parameters

    Returns Promise<void>

    A promise that resolves when the deletion is complete.

    import { Pinecone } from '@pinecone-database/pinecone';
    const pc = new Pinecone();

    const index = pc.preview.index('my-schema-index');

    // Delete specific documents by ID
    await index.deleteDocuments('my-namespace', { ids: ['doc-1', 'doc-2'] });

    // Delete all documents in the namespace
    await index.deleteDocuments('my-namespace', { deleteAll: true });

    Errors.PineconeArgumentError when neither ids nor deleteAll is set, both are set at the same time, or ids is an empty array.

    Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

  • Alpha

    Fetches documents from a namespace by their IDs.

    Parameters

    Returns Promise<PreviewFetchDocumentsResponse>

    A promise that resolves to a PreviewFetchDocumentsResponse containing a documents map, namespace, and usage.

    import { Pinecone } from '@pinecone-database/pinecone';
    const pc = new Pinecone();

    const index = pc.preview.index('my-schema-index');

    // Fetch all fields
    const result = await index.fetchDocuments('my-namespace', {
    ids: ['doc-1', 'doc-2'],
    });
    console.log(result);
    // {
    // documents: {
    // 'doc-1': { _id: 'doc-1', chunk_text: 'Machine learning is fascinating' },
    // 'doc-2': { _id: 'doc-2', chunk_text: 'Vector databases enable semantic search' },
    // },
    // namespace: 'my-namespace',
    // usage: { read_units: 1 }
    // }

    // Fetch only specific fields
    const partial = await index.fetchDocuments('my-namespace', {
    ids: ['doc-1'],
    includeFields: ['chunk_text'],
    });

    Errors.PineconeArgumentError when ids is empty or not provided.

    Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.

  • Alpha

    Searches for documents in a namespace using one or more scoring methods.

    The scoreBy array specifies how documents are ranked. Supported scoring method types are text (BM25), dense_vector, sparse_vector, and query_string. Multiple scoring methods can be combined for hybrid search.

    Parameters

    Returns Promise<PreviewSearchDocumentsResponse>

    A promise that resolves to a PreviewSearchDocumentsResponse containing matches, namespace, and usage.

    import { Pinecone } from '@pinecone-database/pinecone';
    const pc = new Pinecone();

    const index = pc.preview.index('my-schema-index');
    const results = await index.searchDocuments('my-namespace', {
    scoreBy: [
    { type: 'text', field: 'chunk_text', query: 'machine learning' },
    ],
    topK: 5,
    includeFields: ['chunk_text'],
    });
    console.log(results);
    // {
    // matches: [
    // { _id: 'doc-1', _score: 0.98, chunk_text: 'Machine learning is fascinating' },
    // { _id: 'doc-2', _score: 0.72, chunk_text: 'Vector databases enable semantic search' },
    // ],
    // namespace: 'my-namespace',
    // usage: { readUnits: 1 }
    // }

    Errors.PineconeArgumentError when scoreBy is empty or topK is less than 1.

    Errors.PineconeConnectionError when network problems or an outage of Pinecone's APIs prevent the request from being completed.