From 59025f67d09a6ff4282ea6bc0611bd3dc804a6cb Mon Sep 17 00:00:00 2001 From: rohanshah18 Date: Fri, 19 Jul 2024 10:54:31 -0400 Subject: [PATCH] prepare for v2.0.0 release and update README + add migration guide --- CHANGELOG.md | 3 + README.md | 78 ++++++++++++---- gradle.properties | 2 +- .../java/io/pinecone/commons/Constants.java | 2 +- v1-migration.md | 2 +- v2-migration.md | 92 +++++++++++++++++++ 6 files changed, 157 insertions(+), 22 deletions(-) create mode 100644 v2-migration.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a930713..4dac5b19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ [comment]: <> (When bumping [pc:VERSION_LATEST_RELEASE] create a new entry below) ### Unreleased version +### 2.0.0 +- Add deletion protection + ### 1.2.2 - Add support for proxy configuration - Fix user-agent for grpc diff --git a/README.md b/README.md index 5216eb55..6b0b0c9e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Maven: io.pinecone pinecone-client - 1.2.2 + 2.0.0 ``` @@ -28,8 +28,8 @@ implementation "io.pinecone:pinecone-client:1.2.2" [comment]: <> (^ [pc:VERSION_LATEST_RELEASE]) -Alternatively, you can use our standalone uberjar [pinecone-client-1.2.2-all.jar](https://repo1.maven.org/maven2/io/pinecone/pinecone-client/1.2.2/pinecone-client-1.2.2-all.jar), which bundles the pinecone -client and all dependencies together. You can include this in your classpath like you do with any 3rd party JAR without +Alternatively, you can use our standalone uberjar [pinecone-client-2.0.0-all.jar](https://repo1.maven.org/maven2/io/pinecone/pinecone-client/2.0.0/pinecone-client-2.0.0-all.jar), which bundles the pinecone +client and all dependencies together. You can include this in your classpath like you do with any 3rd party JAR without having to obtain the *pinecone-client* dependencies separately. [comment]: <> (^ [pc:VERSION_LATEST_RELEASE]) @@ -94,19 +94,17 @@ serverless and regional availability, see [Understanding indexes](https://docs.p import io.pinecone.clients.Pinecone; import org.openapitools.client.model.IndexModel; -public class CreateServerlessIndexExample { - public static void main(String[] args) { - Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); +... + +Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); - String indexName = "example-index"; - String similarityMetric = "cosine"; - int dimension = 1538; - String cloud = "aws"; - String region = "us-west-2"; +String indexName = "example-index"; +String similarityMetric = "cosine"; +int dimension = 1538; +String cloud = "aws"; +String region = "us-west-2"; - IndexModel indexModel = pinecone.createServerlessIndex(indexName, similarityMetric, dimension, cloud, region); - } -} +IndexModel indexModel = pinecone.createServerlessIndex(indexName, similarityMetric, dimension, cloud, region, DeletionProtection.ENABLED); ``` ### Create a pod index @@ -129,6 +127,26 @@ String podType = "p1.x1"; IndexModel indexModel = pinecone.createPodsIndex(indexName, dimension, environment, podType, similarityMetric); ``` +### Create a pod index with deletion protection enabled +The following is an example of creating a pod-based index with deletion protection enabled. For all the possible +configuration options, see `main/java/io/pinecone/clients/Pinecone.java`. + +```java +import io.pinecone.clients.Pinecone; +import org.openapitools.client.model.IndexModel; +... + +Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); + +String indexName = "example-index"; +int dimension = 1538; +String environment = "us-east-1-aws"; +String podType = "p1.x1"; + +IndexModel indexModel = pinecone.createPodsIndex(indexName, dimension, environment, podType, DeletionProtection.ENABLED); +``` + + ## List indexes The following example returns all indexes (and their corresponding metadata) in your project. @@ -183,7 +201,33 @@ String indexName = "example-index"; String podType = "p1.x1"; int newNumberOfReplicas = 7; -pinecone.configureIndex(indexName, podType, newNumberOfReplicas); +pinecone.configurePodsIndex(indexName, podType, newNumberOfReplicas); +``` + +## Enable deletion protection for pod index + +The following example enables deletion protection of a pod-based index. + +```java +import io.pinecone.clients.Pinecone; +... + +Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); + +pinecone.configurePodsIndex(indexName, DeletionProtection.ENABLED); +``` + +## Enable deletion protection for serverless index + +The following example enables deletion protection of a serverless index. + +```java +import io.pinecone.clients.Pinecone; +... + +Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); + +pinecone.configureServerlessIndex(indexName, DeletionProtection.ENABLED); ``` ## Describe index statistics @@ -206,10 +250,6 @@ DescribeIndexStatsResponse indexStatsResponse = index.describeIndexStats(); Operations related to the indexing, deleting, and querying of vectors are called [data plane](https://docs.pinecone.io/reference/api/introduction#data-plane) operations. - - - - The following example upserts vectors to `example-index`. ```java diff --git a/gradle.properties b/gradle.properties index b1ce1762..65478e93 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -pineconeClientVersion = 1.2.2 +pineconeClientVersion = 2.0.0 diff --git a/src/main/java/io/pinecone/commons/Constants.java b/src/main/java/io/pinecone/commons/Constants.java index b93330c5..77d4b34b 100644 --- a/src/main/java/io/pinecone/commons/Constants.java +++ b/src/main/java/io/pinecone/commons/Constants.java @@ -1,5 +1,5 @@ package io.pinecone.commons; public class Constants { - public static final String pineconeClientVersion = "v1.2.2"; + public static final String pineconeClientVersion = "v2.0.0"; } diff --git a/v1-migration.md b/v1-migration.md index 4394232c..f072345d 100644 --- a/v1-migration.md +++ b/v1-migration.md @@ -97,7 +97,7 @@ controlPlaneClient.createIndex(createIndexRequest); **After: ≥ 1.0.0** -```python +```java import io.pinecone.clients.Pinecone; import org.openapitools.client.model.IndexModel; ... diff --git a/v2-migration.md b/v2-migration.md new file mode 100644 index 00000000..b0689a5d --- /dev/null +++ b/v2-migration.md @@ -0,0 +1,92 @@ +# Java SDK v2.0.0 Migration Guide + +This migration guide is specific to migrating from versions "**v1.0.x**" and below to "**v2.0.x**". + +## Changes overview + +- Added deletion protection feature which will impact the following existing methods: + - `createServerlessIndex()` is now accepted a new argument: Enum `DeletionProtection` + - Renamed `configureIndex()` to `configurePodsIndex()` + +## Indexes + +### Creating a serverless index +Added enum `DeletionProtection` as an argument + +**Before: ≤ 1.2.2** + +```java +import io.pinecone.clients.Pinecone; +import org.openapitools.client.model.IndexModel; +... + +Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); + +String indexName = "example-index"; +String similarityMetric = "cosine"; +int dimension = 1538; +String cloud = "aws"; +String region = "us-west-2"; + +IndexModel indexModel = pinecone.createServerlessIndex(indexName, + similarityMetric, + dimension, + cloud, + region); +``` + +**After: ≥ 2.0.0** + +```java +import io.pinecone.clients.Pinecone; +import org.openapitools.client.model.IndexModel; +... + +Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); + +String indexName = "example-index"; +String similarityMetric = "cosine"; +int dimension = 1538; +String cloud = "aws"; +String region = "us-west-2"; + +IndexModel indexModel = pinecone.createServerlessIndex(indexName, + similarityMetric, + dimension, + cloud, + region, + DeletionProtection.ENABLED); +``` + +## Configuring indexes +Renamed `configureIndex()` to `configurePodsIndex()` + +**Before: ≤ 1.2.2** + +```java +import io.pinecone.clients.Pinecone; +... + +Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); + +String indexName = "my-index"; +String podType = "p1.x1"; +int newNumberOfReplicas = 7; + +pinecone.configureIndex(indexName, podType, newNumberOfReplicas); +``` + +**After: ≥ 2.0.0** + +```java +import io.pinecone.clients.Pinecone; +... + +Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); + +String indexName = "my-index"; +String podType = "p1.x1"; +int newNumberOfReplicas = 7; + +pinecone.configurePodsIndex(indexName, podType, newNumberOfReplicas); +``` \ No newline at end of file