Pinecone TypeScript SDK - v9.0.0
    Preparing search index...

    Class Indexes

    Indexes store documents and define the fields available for search. Access index management through Pinecone.indexes; do not construct this class directly. Use Pinecone.index to read, write, and search data within an index.

    import { Pinecone } from '@pinecone-database/pinecone';

    const pc = new Pinecone();
    const indexes = await pc.indexes.list();
    Index
    • Updates an index configuration.

      Omitted fields remain unchanged.

      Parameters

      • name: string

        The index name, such as product-catalog.

      • options: ConfigureIndexResourceOptions

        The settings to change; provide at least one field.

      Returns Promise<IndexModel>

      The updated index configuration and status.

      Errors.PineconeArgumentError when the name is empty or no configuration field is provided.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const index = await pc.indexes.configure('product-catalog', {
      deletionProtection: 'enabled',
      });
      console.log(index.deletionProtection);
    • Creates an index with searchable fields defined by a schema.

      Creation returns before the index is ready unless waitUntilReady is true.

      Parameters

      • options: CreateIndexOptions & { suppressConflicts?: false }

        The index name and schema. Set waitUntilReady to wait before writing data.

      Returns Promise<IndexModel>

      The index configuration and status.

      Errors.PineconeArgumentError when the index name or schema is missing.

      Errors.PineconeConflictError when an index with this name already exists.

      Errors.PineconeTimeoutError when the readiness timeout expires.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const index = await pc.indexes.create({
      name: 'product-catalog',
      schema: { fields: { description: { type: 'string', fullTextSearch: {} } } },
      waitUntilReady: true,
      });
      console.log(index.name);

      Indexes.createForModel to embed document text with an integrated model.

    • Creates an index with searchable fields defined by a schema.

      Creation returns before the index is ready unless waitUntilReady is true.

      Parameters

      • options: CreateIndexOptions

        The index name and schema. Set waitUntilReady to wait before writing data.

      Returns Promise<void | IndexModel>

      The index configuration and status, or undefined if suppressConflicts ignores an existing index.

      Errors.PineconeArgumentError when the index name or schema is missing.

      Errors.PineconeConflictError when the name exists and suppressConflicts is false.

      Errors.PineconeTimeoutError when the readiness timeout expires.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const index = await pc.indexes.create({
      name: 'product-catalog',
      schema: { fields: { description: { type: 'string', fullTextSearch: {} } } },
      suppressConflicts: true,
      });
      console.log(index?.name);

      Indexes.createForModel to embed document text with an integrated model.

    • Creates an index that embeds document text with an integrated model.

      Creation returns before the index is ready unless waitUntilReady is true.

      Parameters

      • options: CreateIndexForModelOptions & { suppressConflicts?: false }

        The index name, cloud, region, and embedding configuration. Use fieldMap to select your text field.

      Returns Promise<IndexModel>

      The index configuration and status.

      Errors.PineconeArgumentError when required index or embedding settings are missing or the metric is invalid.

      Errors.PineconeConflictError when an index with this name already exists.

      Errors.PineconeTimeoutError when the readiness timeout expires.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const index = await pc.indexes.createForModel({
      name: 'product-catalog',
      cloud: 'aws',
      region: 'us-east-1',
      embed: {
      model: 'multilingual-e5-large',
      fieldMap: { text: 'description' },
      },
      waitUntilReady: true,
      });
      console.log(index.name);

      Indexes.create to define vector or full-text search fields yourself.

    • Creates an index that embeds document text with an integrated model.

      Creation returns before the index is ready unless waitUntilReady is true.

      Parameters

      • options: CreateIndexForModelOptions

        The index name, cloud, region, and embedding configuration. Use fieldMap to select your text field.

      Returns Promise<void | IndexModel>

      The index configuration and status, or undefined if suppressConflicts ignores an existing index.

      Errors.PineconeArgumentError when required index or embedding settings are missing or the metric is invalid.

      Errors.PineconeConflictError when the name exists and suppressConflicts is false.

      Errors.PineconeTimeoutError when the readiness timeout expires.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const index = await pc.indexes.createForModel({
      name: 'product-catalog',
      cloud: 'aws',
      region: 'us-east-1',
      embed: {
      model: 'multilingual-e5-large',
      fieldMap: { text: 'description' },
      },
      suppressConflicts: true,
      });
      console.log(index?.name);

      Indexes.create to define vector or full-text search fields yourself.

    • Deletes an index and its data.

      Disable deletion protection first. The index may still be terminating when this call returns.

      Parameters

      • name: string

        The index name, such as product-catalog.

      Returns Promise<void>

      Resolves when the deletion request is accepted.

      Errors.PineconeArgumentError when the index name is empty.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      await pc.indexes.delete('product-catalog');
    • Retrieves the configuration, schema, and readiness of an index.

      Parameters

      • indexName: string

        The index name, such as product-catalog.

      Returns Promise<IndexModel>

      The index configuration, host, schema, and current status.

      Errors.PineconeArgumentError when the index name is empty.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const index = await pc.indexes.describe('product-catalog');
      console.log(index.status.ready);
    • Lists all indexes in the project.

      Returns Promise<IndexList>

      The indexes and their configuration, schema, and readiness status.

      import { Pinecone } from '@pinecone-database/pinecone';

      const pc = new Pinecone();
      const result = await pc.indexes.list();
      console.log(result.indexes);