You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Support for Dedicated Read Capacity (DRN) and Metadata Schema Configuration (#202)
## Problem
Add Support for Dedicated Read Capacity (DRN) and Metadata Schema
Configuration
## Solution
This PR adds support for Dedicated Read Capacity (DRN) and Metadata
Schema Configuration for serverless indexes. These features allow users
to:
1. **Configure dedicated read nodes** for better performance and cost
predictability
2. **Limit metadata indexing** to specific fields for improved
performance
3. **Configure read capacity** on existing serverless indexes
#### 1. Create Serverless Index with Read Capacity and Schema
Added overloaded `createServerlessIndex` method that accepts:
- `ReadCapacity` parameter for configuring OnDemand or Dedicated read
capacity
- `BackupModelSchema` parameter for configuring metadata schema
```java
// Create index with Dedicated read capacity
ScalingConfigManual manual = new ScalingConfigManual().shards(2).replicas(2);
ReadCapacityDedicatedConfig dedicated = new ReadCapacityDedicatedConfig()
.nodeType("t1")
.scaling("Manual")
.manual(manual);
ReadCapacity readCapacity = new ReadCapacity(
new ReadCapacityDedicatedSpec().mode("Dedicated").dedicated(dedicated));
IndexModel indexModel = pinecone.createServerlessIndex(
indexName, "cosine", 1536, "aws", "us-west-2",
"enabled", tags, readCapacity, null);
// Create index with metadata schema
Map<String, BackupModelSchemaFieldsValue> fields = new HashMap<>();
fields.put("genre", new BackupModelSchemaFieldsValue().filterable(true));
fields.put("year", new BackupModelSchemaFieldsValue().filterable(true));
BackupModelSchema schema = new BackupModelSchema().fields(fields);
IndexModel indexModel = pinecone.createServerlessIndex(
indexName, "cosine", 1536, "aws", "us-west-2",
"enabled", tags, null, schema);
```
#### 2. Create Index for Model with Read Capacity and Schema
Added overloaded `createIndexForModel` method that accepts:
- `ReadCapacity` parameter
- `BackupModelSchema` parameter
#### 3. Configure Read Capacity on Existing Index
Enhanced `configureServerlessIndex` method to accept flattened
parameters for easier use:
```java
// Switch to Dedicated read capacity
IndexModel indexModel = pinecone.configureServerlessIndex(
indexName, "enabled", tags, null, "Dedicated", "t1", 2, 2);
// Switch to OnDemand read capacity
IndexModel indexModel = pinecone.configureServerlessIndex(
indexName, "enabled", tags, null, "OnDemand", null, null, null);
```
**Note:** Read capacity settings can only be updated once per hour per
index.
### Documentation
- Updated `README.md` with examples for:
- Creating serverless indexes with dedicated read capacity
- Creating serverless indexes with OnDemand read capacity
- Creating serverless indexes with metadata schema
- Configuring read capacity on existing indexes
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Infrastructure change (CI configs, etc)
- [ ] Non-code change (docs, etc)
- [ ] None of the above: (explain here)
## Test Plan
- Added comprehensive integration tests in
`ReadCapacityAndSchemaTest.java`:
- Create serverless index with OnDemand read capacity
- Create serverless index with Dedicated read capacity
- Create serverless index with metadata schema
- Create serverless index with both read capacity and schema
- Create index for model with read capacity and schema
- Configure read capacity on existing index
- Added helper method `waitUntilReadCapacityIsReady()` in
`TestUtilities.java` to wait for read capacity status to be "Ready"
before configuring (required by API).
- Note: Tests for switching read capacity modes and scaling are omitted
due to API rate limits (once per hour per index).
### Create a serverless index with dedicated read capacity
190
+
191
+
The following example creates a serverless index with dedicated read capacity nodes for better performance and cost predictability. For more information, see [Dedicated Read Nodes](https://docs.pinecone.io/guides/index-data/dedicated-read-nodes).
### Create a serverless index with OnDemand read capacity
227
+
228
+
The following example explicitly creates a serverless index with OnDemand read capacity (the default mode). OnDemand provides pay-per-use pricing with automatic scaling.
### Create a serverless index with metadata schema
256
+
257
+
The following example creates a serverless index with metadata schema configuration to limit metadata indexing to specific fields for improved performance.
### Configure read capacity on an existing serverless index
444
+
445
+
The following example shows how to configure or change the read capacity mode of an existing serverless index. You can switch between OnDemand and Dedicated modes, or scale dedicated read nodes.
446
+
447
+
**Note:** Read capacity settings can only be updated once per hour per index.
0 commit comments