Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
78 changes: 59 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Maven:
<dependency>
<groupId>io.pinecone</groupId>
<artifactId>pinecone-client</artifactId>
<version>1.2.2</version>
<version>2.0.0</version>
</dependency>
```

Expand All @@ -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])
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pineconeClientVersion = 1.2.2
pineconeClientVersion = 2.0.0
2 changes: 1 addition & 1 deletion src/main/java/io/pinecone/commons/Constants.java
Original file line number Diff line number Diff line change
@@ -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";
}
2 changes: 1 addition & 1 deletion v1-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ controlPlaneClient.createIndex(createIndexRequest);

**After: ≥ 1.0.0**

```python
```java
import io.pinecone.clients.Pinecone;
import org.openapitools.client.model.IndexModel;
...
Expand Down
92 changes: 92 additions & 0 deletions v2-migration.md
Original file line number Diff line number Diff line change
@@ -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);
```