Skip to content

Commit

Permalink
[Docs] Update migration guide with notes on deprecated utils (#128)
Browse files Browse the repository at this point in the history
## Problem

Docs missing information

## Solution

- [x] Non-code change (docs, etc)
  • Loading branch information
jhamon authored Oct 2, 2023
1 parent 3de088e commit c6a8586
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ await pinecone.createIndex({
metadataConfig: {
indexed: ['product_type'],
},

// This option tells the client not to throw if the index already exists.
suppressConflicts: true,

// This option tells the client not to resolve the promise until the
// index is ready.
waitUntilReady: true,
});
```

Expand Down
39 changes: 39 additions & 0 deletions v1-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,3 +620,42 @@ const stats = await index.describeIndexStats();
// totalRecordCount: 10001502
// }
```

### Utilities `waitUntilIndexIsReady` and `createIndexIfNotExists`

In the v1 client, the needs served by these utility functions in v0.x beta clients are served by additional options to the `createIndex` method.

```typescript
// v0.x beta releases
import { PineconeClient, utils } from '@pinecone-database/pinecone';

const { createIndexIfNotExists, waitUntilIndexIsReady } = utils;

const pineconeClient = new PineconeClient();
await pineconeClient.init({
apiKey: 'your-api-key',
environment: 'your-environment',
});

await createIndexIfNotExists(pineconeClient, 'sample-index', 1536);
await waitUntilIndexIsReady(pineconeClient, 'sample-index');
```

```typescript
// v1.0.0
import { Pinecone } from '@pinecone-database/pinecone';

const pinecone = new Pinecone();
await pinecone.createIndex({
name: 'sample-index',
dimension: 1536,

// This option tells the client not to throw if the index already exists.
// It serves as replacement for createIndexIfNotExists
suppressConflicts: true,

// This option tells the client not to resolve the promise until the
// index is ready. It replaces waitUntilIndexIsReady.
waitUntilReady: true,
});
```

0 comments on commit c6a8586

Please sign in to comment.