id
stringlengths 14
15
| text
stringlengths 92
1.69k
| source
stringclasses 25
values |
|---|---|---|
03cd7e06b3cc-0
|
This document contains details about Pinecone releases. For information about using specific features, see our API reference.
June 21, 2023
The new gcp-starter region is now in public preview. This region has distinct limitations from other Starter Plan regions. gcp-starter is the default region for some new users.
April 26, 2023
Indexes in the starter plan now support approximately 100,000 1536-dimensional embeddings with metadata. Capacity is proportional for other dimensionalities.
April 3, 2023
Pinecone now supports new US and EU cloud regions.
March 21, 2023
Pinecone now supports enterprise SSO. Contact us at support@pinecone.io to set up your integration.
March 1, 2023
Pinecone now supports 40kb of metadata per vector.
February 22, 2023
Sparse-dense embeddings are now in Public Preview.
Pinecone now supports vectors with sparse and dense values. To use sparse-dense embeddings in Python, upgrade to Python client version 2.2.0.
Pinecone Python client version 2.2.0 is available
Python client version 2.2.0 with support for sparse-dense embeddings is now available on GitHub and PYPI.
February 15, 2023
New Node.js client is now available in public preview
|
https://docs.pinecone.io/docs/release-notes
|
03cd7e06b3cc-1
|
You can now try out our new Node.js client for Pinecone.
February 14, 2023
New usage reports in the Pinecone console
You can now monitor your current and projected Pinecone usage with the Usage dashboard.
January 31, 2023
Pinecone is now available in AWS Marketplace
You can now sign up for Pinecone billing through Amazon Web Services Marketplace.
January 3, 2023
Pinecone Python client version 2.1.0 is now available on GitHub.
The latest release of the Python client makes the following changes:
|
https://docs.pinecone.io/docs/release-notes
|
03cd7e06b3cc-2
|
Fixes "Connection Reset by peer" error after long idle periods
Adds typing and explicit names for arguments in all client operations
Adds docstrings to all client operations
Adds Support for batch upserts by passing batch_size to the upsert method
Improves gRPC query results parsing performance
December 22, 2022
Pinecone is now available in GCP Marketplace
You can now sign up for Pinecone billing through Google Cloud Platform Marketplace.
December 6, 2022
Organizations are generally available
Pinecone now features organizations, which allow one or more users to control billing and project settings across multiple projects owned by the same organization.
p2 pod type is generally available
The p2 pod type is now generally available and ready for production workloads. p2 pods are now available in the Starter plan and support the dotproduct distance metric.
Performance improvements
Bulk vector_deletes are now up to 10x faster in many circumstances.
Creating collections is now faster.
|
https://docs.pinecone.io/docs/release-notes
|
03cd7e06b3cc-3
|
October 31, 2022
Hybrid search (Early access)
Pinecone now supports keyword-aware semantic search with the new hybrid search indexes and endpoints. Hybrid search enables improved relevance for semantic search results by combining them with keyword search.
This is an early access feature and is available only by signing up.
October 17, 2022
Status page
The new Pinecone Status Page displays information about the status of the Pinecone service, including the status of individual cloud regions and a log of recent incidents.
September 16, 2022
Public collections
You can now create indexes from public collections, which are collections containing public data from real-world data sources. Currently, public collections include the Glue - SSTB collection, the TREC Question classification collection, and the SQuAD collection.
August 16, 2022
Collections (Public Preview)("Beta")
You can now make static copies of your index using collections. After you create a collection from an index, you can create a new index from that collection. The new index can use any pod type and any number of pods. Collections only consume storage.
This is a public preview feature and is not appropriate for production workloads.
Vertical scaling
|
https://docs.pinecone.io/docs/release-notes
|
03cd7e06b3cc-4
|
Vertical scaling
You can now change the size of the pods for a live index to accommodate more vectors or queries without interrupting reads or writes. The p1 and s1 pod types are now available in 4 different sizes: 1x, 2x, 4x, and 8x. Capacity and compute per pod double with each size increment.
p2 pod type (Public Preview)("Beta")
The new p2 pod type provides search speeds of around 5ms and throughput of 200 queries per second per replica, or approximately 10x faster speeds and higher throughput than the p1 pod type, depending on your data and network conditions.
This is a public preview feature and is not appropriate for production workloads.
Improved p1 and s1 performance
The s1 and p1 pod types now offer approximately 50% higher query throughput and 50% lower latency, depending on your workload.
July 26, 2022
You can now specify a metadata filter to get results for a subset of the vectors in your index by calling describe_index_stats with a filter object.
The describe_index_stats operation now uses the POST HTTP request type. The filter parameter is only accepted by describe_index_stats calls using the POST request type. Calls to describe_index_stats using the GET request type are now deprecated.
July 12, 2022
Pinecone Console Guided Tour
|
https://docs.pinecone.io/docs/release-notes
|
03cd7e06b3cc-5
|
Pinecone Console Guided Tour
You can now choose to follow a guided tour in the Pinecone Console. This interactive tutorial walks you through creating your first index, upserting vectors, and querying your data. The purpose of the tour is to show you all the steps you need to start your first project in Pinecone.
June 24, 2022
Updated response codes
The create_index, delete_index, and scale_index operations now use more specific HTTP response codes that describe the type of operation that succeeded.
June 7, 2022
Selective metadata indexing
You can now store more metadata and more unique metadata values! Select which metadata fields you want to index for filtering and which fields you only wish to store and retrieve. When you index metadata fields, you can filter vector search queries using those fields. When you store metadata fields without indexing them, you keep memory utilization low, especially when you have many unique metadata values, and therefore can fit more vectors per pod.
Single-vector queries
You can now specify a single query vector using the vector input. We now encourage all users to query using a single vector rather than a batch of vectors, because batching queries can lead to long response messages and query times, and single queries execute just as fast on the server side.
Query by ID
|
https://docs.pinecone.io/docs/release-notes
|
03cd7e06b3cc-6
|
Query by ID
You can now query your Pinecone index using only the ID for another vector. This is useful when you want to search for the nearest neighbors of a vector that is already stored in Pinecone.
Improved index fullness accuracy
The index fullness metric in describe_index_stats() results is now more accurate.
April 25, 2022
Partial updates (Public Preview)
You can now perform a partial update by ID and individual value pairs. This allows you to update individual metadata fields without having to upsert a matching vector or update all metadata fields at once.
New metrics
Users on all plans can now see metrics for the past one (1) week in the Pinecone console. Users on the Enterprise and Enterprise Dedicated plan now have access to the following metrics via the Prometheus metrics endpoint:
|
https://docs.pinecone.io/docs/release-notes
|
03cd7e06b3cc-7
|
pinecone_vector_count
pinecone_request_count_total
pinecone_request_error_count_total
pinecone_request_latency_seconds
pinecone_index_fullness (Public Preview)
Note: The accuracy of the pinecone_index_fullness metric is improved. This may result in changes from historic reported values. This metric is in public preview.
Spark Connector
Spark users who want to manage parallel upserts into Pinecone can now use the official Spark connector for Pinecone to upsert their data from a Spark dataframe.
Support for Boolean and float metadata in Pinecone indexes
You can now add Boolean and float64 values to metadata JSON objects associated with a Pinecone index.
New state field in describe_index results
The describe_index operation results now contain a value for state, which describes the state of the index. The possible values for state are Initializing, ScalingUp, ScalingDown, Terminating, and Ready.
Delete by metadata filter
The Delete operation now supports filtering my metadata.Updated 10 days ago LimitsArchitectureDid this page help you?YesNo
|
https://docs.pinecone.io/docs/release-notes
|
155b13a20033-0
|
Overview
This document describes the security protocols and practices in use by Pinecone.
API keys
Each Pinecone project has one or more API keys. In order to make calls to the Pinecone API, a user must provide a valid API key for the relevant Pinecone project.
Role-based access controls (RBAC)
Each Pinecone organization can assign users roles with respect to the organization and projects within the organization. These roles determine what permissions users have to make changes to the organization's billing, projects, and other users. To learn more, see organization roles.
Organization single sign-on (SSO)
SSO allows organizations to manage their teams' access to Pinecone through their identity management solution. Once your integration is configured, you can require that users from your domain sign in through SSO, and you can specify a default role for teammates when they sign up. Only organizations in the enterprise tier can set up SSO. To set up your SSO integration, contact Pinecone support at support@pinecone.io.
End-to-end encryption (E2EE)
Pinecone provides end-to-end encryption for user data, including encryption in transit and at rest.
Encryption in transit
|
https://docs.pinecone.io/docs/security
|
155b13a20033-1
|
Encryption in transit
Pinecone uses standard protocols to encrypt user data in transit. Clients open HTTPS or gRPC connections to the Pinecone API; the Pinecone API gateway uses gRPC connections to user deployments in the cloud. These HTTPS and gRPC connections use the TLS 1.2 protocol with 256-bit Advanced Encryption Standard (AES-256) encryption. See Fig. 1 below.
Figure 1: Pinecone encryption in transit
Traffic is also encrypted in transit between the Pinecone backend and cloud infrastructure services, such as S3 and GCS. For more information, see Google Cloud Platform and AWS security documentation.
Encryption at rest
Pinecone encrypts stored data using the 256-bit Advanced Encryption Standard (AES-256) encryption algorithm.Updated about 1 month ago ArchitectureDid this page help you?YesNo
|
https://docs.pinecone.io/docs/security
|
8ef910d61d8e-0
|
This page provides installation instructions, usage examples, and a reference for the Pinecone Node.JS client.
⚠️WarningThis is a public preview ("Beta") client. Test thoroughly before
using this client for production workloads. No SLAs or technical support
commitments are provided for this client. Expect potential breaking
changes in future releases.
Getting Started
Installation
Use the following shell command to install the Node.JS client for use with Node.JS versions 17 and above:
Shellnpm install @pinecone-database/pinecone
Alternatively, you can install Pinecone with Yarn:
Shellyarn add @pinecone-database/pinecone
Usage
Initialize the client
To initialize the client, instantiate the PineconeClient class and call the init method. The init method takes an object with the apiKey and environment properties:
JavaScriptimport { PineconeClient } from "@pinecone-database/pinecone";
const pinecone = new PineconeClient();
await pinecone.init({
environment: "YOUR_ENVIRONMENT",
apiKey: "YOUR_API_KEY",
});
Create index
The following example creates an index without a metadata configuration. By default, Pinecone indexes all metadata.
JavaScriptawait pinecone.createIndex({
createRequest: {
name: "example-index",
dimension: 1024,
},
});
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-1
|
The following example creates an index that only indexes the "color" metadata field. Queries against this index cannot filter based on any other metadata field.
JavaScriptawait pinecone.createIndex({
createRequest: {
name: "example-index-2",
dimension: 1024,
metadataConfig: {
indexed: ["color"],
},
},
});
List indexes
The following example logs all indexes in your project.
JavaScriptconst indexesList = await pinecone.listIndexes();
Describe index
The following example logs information about the index example-index.
JavaScriptconst indexDescription = await pinecone.describeIndex({
indexName: "example-index",
});
Delete index
The following example deletes example-index.
JavaScriptawait pinecone.deleteIndex({
indexName: "example-index",
});
Scale replicas
The following example sets the number of replicas and pod type for example-index.
JavaScriptawait pinecone.configureIndex({
indexName: "example-index",
patchRequest: {
replicas: 2,
podType: "p2",
},
});
Describe index statistics
The following example returns statistics about the index example-index.
JavaScriptconst index = pinecone.Index("example-index");
const indexStats = index.describeIndexStats({
describeIndexStatsRequest: {
filter: {},
},
});
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-2
|
Upsert vectors
The following example upserts vectors to example-index.
JavaScriptconst index = pinecone.Index("example-index");
const upsertRequest = {
vectors: [
{
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
metadata: {
genre: "drama",
},
},
{
id: "vec2",
values: [0.2, 0.3, 0.4, 0.5],
metadata: {
genre: "action",
},
},
],
namespace: "example-namespace",
};
const upsertResponse = await index.upsert({ upsertRequest });
Query an index
The following example queries the index example-index with metadata filtering.
JavaScriptconst index = pinecone.Index("example-index");
const queryRequest = {
vector: [0.1, 0.2, 0.3, 0.4],
topK: 10,
includeValues: true,
includeMetadata: true,
filter: {
genre: { $in: ["comedy", "documentary", "drama"] },
},
namespace: "example-namespace",
};
const queryResponse = await index.query({ queryRequest });
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-3
|
Delete vectors
The following example deletes vectors by ID.
JavaScriptconst index = pinecone.Index("example-index");
await index.delete1({
ids: ["vec1", "vec2"],
namespace: "example-namespace",
});
Fetch vectors
The following example fetches vectors by ID.
JavaScriptconst index = pinecone.Index("example-index");
const fetchResponse = await index.fetch({
ids: ["vec1", "vec2"],
namespace: "example-namespace",
});
Update vectors
The following example updates vectors by ID.
JavaScriptconst index = pinecone.Index("example-index");
const updateRequest = {
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
setMetadata: { genre: "drama" },
namespace: "example-namespace",
};
const updateResponse = await index.update({ updateRequest });
Create collection
The following example creates the collection example-collection from example-index.
JavaScriptconst createCollectionRequest = {
name: "example-collection",
source: "example-index",
};
await pinecone.createCollection({
createCollectionRequest,
});
List collections
The following example returns a list of the collections in the current project.
JavaScriptconst collectionsList = await pinecone.listCollections();
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-4
|
Describe a collection
The following example returns a description of the collection example-collection.
JavaScriptconst collectionDescription = await pinecone.describeCollection({
collectionName: "example-collection",
});
Delete a collection
The following example deletes the collection example-collection.
JavaScriptawait pinecone.deleteCollection({
collectionName: "example-collection",
});
Reference
For the REST API or other clients, see the API reference.
init()
pinecone.init(configuration: PineconeClientConfiguration)
Initialize the Pinecone client.
ParametersTypeDescriptionconfigurationPineconeClientConfigurationThe configuration for the Pinecone client.
Types
PineconeClientConfiguration
ParametersTypeDescriptionapiKeystringThe API key for the Pinecone service.environmentstringThe cloud environment of your Pinecone project.
Example:
JavaScriptimport { PineconeClient } from "@pinecone-database/pinecone";
const pinecone = new PineconeClient();
await pinecone.init({
apiKey: "YOUR_API_KEY",
environment: "YOUR_ENVIRONMENT",
});
configureIndex()
pinecone.configure_index(indexName: string, patchRequest?: PatchRequest)
Configure an index to change pod type and number of replicas.
ParametersTypeDescriptionrequestParametersConfigureIndexRequestIndex configuration parameters.
Types
ConfigureIndexRequest
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-5
|
ParametersTypeDescriptionindexNamestringThe name of the index.patchRequestPatchRequest(Optional) Patch request parameters.
PatchRequest
ParametersTypeDescriptionreplicasnumber(Optional) The number of replicas to configure for this index.podTypestring(Optional) The new pod type for the index. One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8.
Example:
JavaScriptconst newNumberOfReplicas = 4;
const newPodType = "s1.x4";
await pinecone.configureIndex({
indexName: "example-index",
patchRequest: {
replicas: newNumberOfReplicas,
podType: newPodType,
},
});
createCollection()
pinecone.createCollection(requestParameters: CreateCollectionOperationRequest)
Create a collection from an index.
ParametersTypeDescriptionrequestParametersCreateCollectionOperationRequestCreate collection operation wrapper
Types
CreateCollectionOperationRequest
ParametersTypeDescriptioncreateCollectionRequestCreateCollectionRequestCollection request parameters.
CreateCollectionRequest
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-6
|
ParametersTypeDescriptionnamestringThe name of the collection to be created.sourcestringThe name of the source index to be used as the source for the collection.
Example:
JavaScriptawait pinecone.createCollection({
createCollectionRequest: {
name: "example-collection",
source: "example-index",
},
});
createIndex()
pinecone.createIndex(requestParameters?: CreateIndexRequest)
Create an index.
ParametersTypeDescriptionrequestParametersCreateIndexRequestCreate index operation wrapper
Types
CreateIndexRequest
ParametersTypeDescriptioncreateRequestCreateRequestCreate index request parameters
CreateRequest
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-7
|
ParametersTypeDescriptionnamestrThe name of the index to be created. The maximum length is 45 characters.dimensionintegerThe dimensions of the vectors to be inserted in the index.metricstr(Optional) The distance metric to be used for similarity search: 'euclidean', 'cosine', or 'dotproduct'.podsint(Optional) The number of pods for the index to use, including replicas.replicasint(Optional) The number of replicas.pod_typestr(Optional) The new pod type for the index. One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8.metadata_configobject(Optional) Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when metadata_config is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: {"indexed": ["example_metadata_field"]}source_collectionstr(Optional) The name of the collection to create an index from.
Example:
JavaScript// The following example creates an index without a metadata
// configuration. By default, Pinecone indexes all metadata.
await pinecone.createIndex({
createRequest: {
name: "pinecone-index",
dimension: 1024,
},
});
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-8
|
// The following example creates an index that only indexes
// the 'color' metadata field. Queries against this index
// cannot filter based on any other metadata field.
await pinecone.createIndex({
createRequest: {
name: "example-index-2",
dimension: 1024,
metadata_config: {
indexed: ["color"],
},
},
});
deleteCollection()
pinecone.deleteCollection(requestParameters: DeleteCollectionRequest)
Delete an existing collection.
Types
ParametersTypeDescriptionrequestParametersDeleteCollectionRequestDelete collection request parameters
DeleteCollectionRequest
ParametersTypeDescriptioncollectionNamestringThe name of the collection to delete.
Example:
JavaScriptawait pinecone.deleteCollection({
collectionName: "example-collection",
});
deleteIndex()
pinecone.deleteIndex(requestParameters: DeleteIndexRequest)
Delete an index.
Types
ParametersTypeDescriptionrequestParametersDeleteIndexRequestDelete index request parameters
DeleteIndexRequest
ParametersTypeDescriptionindexNamestringThe name of the index to delete.
Example:
JavaScriptawait pinecone.deleteIndex({
indexName: "example-index",
});
describeCollection()
pinecone.describeCollection(requestParameters: DescribeCollectionRequest)
Get a description of a collection.
Types
ParametersTypeDescriptionrequestParametersDescribeCollectionRequestDescribe collection request parameters
DescribeCollectionRequest
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-9
|
ParametersTypeDescriptioncollectionNamestringThe name of the collection.
Example:
JavaScriptconst collectionDescription = await pinecone.describeCollection({
collectionName: "example-collection",
});
Return:
collectionMeta : object Configuration information and deployment status of the collection.
name : string The name of the collection.
size: integer The size of the collection in bytes.
status: string The status of the collection.
describeIndex()
pinecone.describeIndex(requestParameters: DescribeIndexRequest)
Get a description of an index.
Types
ParametersTypeDescriptionrequestParametersDescribeIndexRequestDescribe index request parameters
DescribeIndexRequest
ParametersTypeDescriptionindexNamestringThe name of the index.
Types
Returns:
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-10
|
database : object
name : string The name of the index.
dimension : integer The dimensions of the vectors to be inserted in the index.
metric : string The distance metric used for similarity search: 'euclidean', 'cosine', or 'dotproduct'.
pods : integer The number of pods the index uses, including replicas.
replicas : integer The number of replicas.
pod_type : string The pod type for the index. One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8.
metadata_config: object Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when metadata_config is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: {"indexed": ["example_metadata_field"]}
status : object
ready : boolean Whether the index is ready to serve queries.
state : string One of Initializing, ScalingUp, ScalingDown, Terminating, or Ready.
Example:
JavaScriptconst indexDescription = await pinecone.describeIndex({
indexName: "example-index",
});
listCollections
pinecone.listCollections()
Return a list of the collections in your project.
Example:
JavaScriptconst collections = await pinecone.listCollections();
Returns:
array of strings The names of the collections in your project.
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-11
|
listIndexes
pinecone.listIndexes()
Return a list of your Pinecone indexes.
Returns:
array of strings The names of the indexes in your project.
Example:
JavaScriptconst indexesList = await pinecone.listIndexes();
Index()
pinecone.Index(indexName: string)
Construct an Index object.
ParametersTypeDescriptionindexNamestringThe name of the index.
Example:
JavaScriptconst index = pinecone.Index("example-index");
Index.delete1()
index.delete(requestParameters: Delete1Request)
Delete items by their ID from a single namespace.
ParametersTypeDescriptionrequestParametersDelete1RequestDelete request parameters
Types
Delete1Request
ParametersTypeDescriptionidsArray(Optional) The IDs of the items to delete.deleteAllboolean(Optional) Indicates that all vectors in the index namespace should be deleted.namespacestr(Optional) The namespace to delete vectors from, if applicable.
Types
Example:
JavaScriptawait index.delete1({
ids: ["example-id-1", "example-id-2"],
namespace: "example-namespace",
});
Index.describeIndexStats()
index.describeIndexStats(requestParameters: DescribeIndexStatsOperationRequest)
Returns statistics about the index's contents, including the vector count per namespace and the number of dimensions.
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-12
|
ParametersTypeDescriptionrequestParametersDescribeIndexStatsOperationRequestDescribe index stats request wrapper
Types
DescribeIndexStatsOperationRequest
ParametersTypeDescriptiondescribeIndexStatsRequestDescribeIndexStatsRequestDescribe index stats request parameters
DescribeIndexStatsRequest
parameterTypeDescriptionfilterobject(Optional) A metadata filter expression.
Returns:
namespaces : object A mapping for each namespace in the index from the namespace name to a
summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.
dimension : int64 The dimension of the indexed vectors.
indexFullness : float The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%.
totalVectorCount : int64 The total number of vectors in the index.
Example:
JavaScriptconst indexStats = await index.describeIndexStats({
describeIndexStatsRequest: {},
});
Read more about filtering for more detail.
Index.fetch()
index.fetch(requestParameters: FetchRequest)
The Fetch operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and metadata.
ParametersTypeDescriptionrequestParametersFetchRequestFetch request parameters
Types
FetchRequest
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-13
|
ParametersTypeDescriptionidsArrayThe vector IDs to fetch. Does not accept values containing spaces.namespacestring(Optional) The namespace containing the vectors.
Returns:
vectors : object Contains the vectors.
namespace : string The namespace of the vectors.
Example:
JavaScriptconst fetchResponse = await index.fetch({
ids: ["example-id-1", "example-id-2"],
namespace: "example-namespace",
});
Index.query()
index.query(requestParameters: QueryOperationRequest)
Search a namespace using a query vector. Retrieves the ids of the most similar items in a namespace, along with their similarity scores.
ParametersTypeDescriptionrequestParametersQueryOperationRequestThe query operation request wrapper.
Types
ParametersTypeDescriptionqueryRequestQueryRequestThe query operation request.
QueryRequest
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-14
|
ParameterTypeDescriptionnamespacestring(Optional) The namespace to query.topKnumberThe number of results to return for each query.filterobject(Optional) The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/.includeValuesboolean(Optional) Indicates whether vector values are included in the response. Defaults to false.includeMetadataboolean(Optional) Indicates whether metadata is included in the response as well as the ids. Defaults to false.vectorArray(Optional) The query vector. This should be the same length as the dimension of the index being queried. Each query() request can contain only one of the parameters id or vector.idstring(Optional) The unique ID of the vector to be used as a query vector. Each query() request can contain only one of the parameters vector or id.
Example:
JavaScriptconst queryResponse = await index.query({
queryRequest: {
namespace: "example-namespace",
topK: 10,
filter: {
genre: { $in: ["comedy", "documentary", "drama"] },
},
includeValues: true,
includeMetadata: true,
vector: [0.1, 0.2, 0.3, 0.4],
},
});
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-15
|
Index.update()
index.update(requestParameters: UpdateOperationRequest)
Updates vectors in a namespace. If a value is included, it will overwrite the previous value.
If setMetadata is included in the updateRequest, the values of the fields specified in it will be added or overwrite the previous value.
ParametersTypeDescriptionrequestParametersUpdateOperationRequestThe update operation wrapper
Types
UpdateOperationRequest
ParametersTypeDescriptionupdateRequestUpdateRequestThe update request.
UpdateRequest
ParameterTypeDescriptionidstringThe vector's unique ID.valuesArray(Optional) Vector data.setMetadataobject(Optional) Metadata to set for the vector.namespacestring(Optional) The namespace containing the vector.
Example:
JavaScriptconst updateResponse = await index.update({
updatedRequest: {
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
setMetadata: {
genre: "drama",
},
namespace: "example-namespace",
},
});
Index.upsert()
index.upsert(requestParameters: UpsertOperationRequest)
Writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value.
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-16
|
ParametersTypeDescriptionrequestParametersUpsertOperationRequestUpsert operation wrapper
Types
UpsertOperationRequest
ParametersTypeDescriptionupsertRequestUpsertRequestThe upsert request.
UpsertRequest
| Parameter | Type | Description |
| vectors | Array | An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
id (str) - The vector's unique id.
values ([float]) - The vector data.
metadata (object) - (Optional) Metadata for the vector. |
| namespace | string | (Optional) The namespace name to upsert vectors. |
Vector
ParameterTypeDescriptionidstringThe vector's unique ID.valuesArrayVector data.metadataobject(Optional) Metadata for the vector.
Returns:
upsertedCount : int64 The number of vectors upserted.
|
https://docs.pinecone.io/docs/node-client
|
8ef910d61d8e-17
|
Example:
JavaScriptconst upsertResponse = await index.upsert({
upsertRequest: {
vectors: [
{
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
metadata: {
genre: "drama",
},
},
{
id: "vec2",
values: [0.1, 0.2, 0.3, 0.4],
metadata: {
genre: "comedy",
},
},
],
namespace: "example-namespace",
},
});
Updated about 1 month ago Python ClientLimitsDid this page help you?YesNo
|
https://docs.pinecone.io/docs/node-client
|
cc60f5f5e4a7-0
|
This page provides installation instructions, usage examples, and a reference for the Pinecone Python client.
Getting Started
Installation
Use the following shell command to install the Python client for use with Python versions 3.6+:
Pythonpip3 install pinecone-client
Alternatively, you can install Pinecone in a Jupyter notebook:
Python!pip3 install pinecone-client
We strongly recommend installing Pinecone in a virtual environment. For more information on using Python virtual environments, see:
PyPA Python Packaging User Guide
Python Virtual Environments: A Primer
There is a gRPC flavor of the client available, which comes with more dependencies in return for faster upload speeds. To install it, use the following command:
Pythonpip3 install "pinecone-client[grpc]"
For the latest development version:
Pythonpip3 install git+https://git@github.com/pinecone-io/pinecone-python-client.git
For a specific development version:
Pythonpip3 install git+https://git@github.com/pinecone-io/pinecone-python-client.git
pip3 install git+https://git@github.com/pinecone-io/pinecone-python-client.git@example-branch-name
pip3 install git+https://git@github.com/pinecone-io/pinecone-python-client.git@259deff
Usage
Create index
The following example creates an index without a metadata configuration. By default, Pinecone indexes all metadata.
Pythonimport pinecone
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-1
|
pinecone.init(api_key="YOUR_API_KEY",
environment="YOUR_ENVIRONMENT")
pinecone.create_index("example-index", dimension=1024)
The following example creates an index that only indexes the "color" metadata field. Queries against this index cannot filter based on any other metadata field.
Pythonmetadata_config = {
"indexed": ["color"]
}
pinecone.create_index("example-index-2", dimension=1024,
metadata_config=metadata_config)
List indexes
The following example returns all indexes in your project.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
active_indexes = pinecone.list_indexes()
Describe index
The following example returns information about the index example-index.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index_description = pinecone.describe_index("example-index")
Delete index
The following example deletes example-index.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
pinecone.delete_index("example-index")
Scale replicas
The following example changes the number of replicas for example-index.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
new_number_of_replicas = 4
pinecone.configure_index("example-index", replicas=new_number_of_replicas)
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-2
|
Describe index statistics
The following example returns statistics about the index example-index.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index = pinecone.Index("example-index")
index_stats_response = index.describe_index_stats()
Upsert vectors
The following example upserts dense vectors to example-index.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index = pinecone.Index("example-index")
upsert_response = index.upsert(
vectors=[
(
"vec1", # Vector ID
[0.1, 0.2, 0.3, 0.4], # Dense vector values
{"genre": "drama"} # Vector metadata
),
(
"vec2",
[0.2, 0.3, 0.4, 0.5],
{"genre": "action"}
)
],
namespace="example-namespace"
)
Query an index
The following example queries the index example-index with metadata filtering.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index = pinecone.Index("example-index")
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-3
|
query_response = index.query(
namespace="example-namespace",
top_k=10,
include_values=True,
include_metadata=True,
vector=[0.1, 0.2, 0.3, 0.4],
filter={
"genre": {"$in": ["comedy", "documentary", "drama"]}
}
)
Delete vectors
The following example deletes vectors by ID.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index = pinecone.Index("example-index")
delete_response = index.delete(ids=["vec1", "vec2"], namespace="example-namespace")
Fetch vectors
The following example fetches vectors by ID.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index = pinecone.Index("example-index")
fetch_response = index.fetch(ids=["vec1", "vec2"], namespace="example-namespace")
Update vectors
The following example updates vectors by ID.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index = pinecone.Index("example-index")
update_response = index.update(
id="vec1",
values=[0.1, 0.2, 0.3, 0.4],
set_metadata={"genre": "drama"},
namespace="example-namespace"
)
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-4
|
Create collection
The following example creates the collection example-collection from example-index.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY",
environment="YOUR_ENVIRONMENT")
pinecone.create_collection("example-collection", "example-index")
List collections
The following example returns a list of the collections in the current project.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
active_collections = pinecone.list_collections()
Describe a collection
The following example returns a description of the collection example-collection.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
collection_description = pinecone.describe_collection("example-collection")
Delete a collection
The following example deletes the collection example-collection.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
pinecone.delete_collection("example-collection")
Reference
For the REST API or other clients, see the API reference.
init()
pinecone.init(**kwargs)
Initialize Pinecone.
ParametersTypeDescriptionapi_keystrYour Pinecone API key.environmentstrThe cloud environment of your Pinecone project.
Example:
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-5
|
configure_index()
pinecone.configure_index(index_name, **kwargs)
Configure an index to change pod type and number of replicas.
ParametersTypeDescriptionindex_namestrThe name of the indexreplicasint(Optional) The number of replicas to configure for this index.pod_typestr(Optional) The new pod type for the index. One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
new_number_of_replicas = 4
pinecone.configure_index('example-index', replicas=new_number_of_replicas)
create_collection()
pinecone.create_collection(**kwargs)
Create a collection from an index.
ParametersTypeDescriptionnamestrThe name of the collection to be created.sourcestrThe name of the source index to be used as the source for the collection.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
pinecone.create_collection('example-collection', 'example-index')
create_index()
pinecone.create_index(**kwargs)
Create an index.
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-6
|
ParametersTypeDescriptionnamestrThe name of the index to be created. The maximum length is 45 characters.dimensionintegerThe dimensions of the vectors to be inserted in the index.metricstr(Optional) The distance metric to be used for similarity search: 'euclidean', 'cosine', or 'dotproduct'.podsint(Optional) The number of pods for the index to use, including replicas.replicasint(Optional) The number of replicas.pod_typestr(Optional) The new pod type for the index. One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8.metadata_configobject(Optional) Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when metadata_config is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: {"indexed": ["example_metadata_field"]}source_collectionstr(Optional) The name of the collection to create an index from.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
## The following example creates an index without a metadata
## configuration. By default, Pinecone indexes all metadata.
pinecone.create_index('example-index', dimension=1024)
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-7
|
## The following example creates an index that only indexes
## the 'color' metadata field. Queries against this index
## cannot filter based on any other metadata field.
metadata_config = {
'indexed': ['color']
}
pinecone.create_index('example-index-2', dimension=1024,
metadata_config=metadata_config)
delete_collection()
pinecone.delete_collection('example-collection')
Delete an existing collection.
ParametersTypeDescriptioncollectionNamestrThe name of the collection to delete.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
pinecone.delete_collection('example-collection')
delete_index()
pinecone.delete_index(indexName)
Delete an existing index.
ParametersTypeDescriptionindex_namestrThe name of the index.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
pinecone.delete_index('example-index')
describe_collection()
pinecone.describe_collection(collectionName)
Get a description of a collection.
ParametersTypeDescriptioncollection_namestrThe name of the collection.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
collection_description = pinecone.describe_collection('example-collection')
Returns:
collectionMeta : object Configuration information and deployment status of the collection.
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-8
|
name : string The name of the collection.
size: integer The size of the collection in bytes.
status: string The status of the collection.
describe_index()
pinecone.describe_index(indexName)
Get a description of an index.
ParametersTypeDescriptionindex_namestrThe name of the index.
Returns:
database : object
name : string The name of the index.
dimension : integer The dimensions of the vectors to be inserted in the index.
metric : string The distance metric used for similarity search: 'euclidean', 'cosine', or 'dotproduct'.
pods : integer The number of pods the index uses, including replicas.
replicas : integer The number of replicas.
pod_type : string The pod type for the index. One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8.
metadata_config: object Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when metadata_config is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: {"indexed": ["example_metadata_field"]}
status : object
ready : boolean Whether the index is ready to serve queries.
state : string One of Initializing, ScalingUp, ScalingDown, Terminating, or Ready.
Example:
Pythonimport pinecone
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-9
|
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
index_description = pinecone.describe_index('example-index')
list_collections()
pinecone.list_collections()
Return a list of the collections in your project.
Returns:
array of strings The names of the collections in your project.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='us-east1-gcp')
active_collections = pinecone.list_collections()
list_indexes()
pinecone.list_indexes()
Return a list of your Pinecone indexes.
Returns:
array of strings The names of the indexes in your project.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
active_indexes = pinecone.list_indexes()
Index()
pinecone.Index(indexName)
Construct an Index object.
ParametersTypeDescriptionindexNamestrThe name of the index.
Example:
Pythonindex = pinecone.Index("example-index")
Index.delete()
Index.delete(**kwargs)
Delete items by their ID from a single namespace.
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-10
|
ParametersTypeDescriptionidsarray(Optional) array of strings vectors to delete.delete_allboolean(Optional) Indicates that all vectors in the index namespace should be deleted.namespacestr(Optional) The namespace to delete vectors from, if applicable.filterobject(Optional) If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See https://www.pinecone.io/docs/metadata-filtering/.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
index = pinecone.Index('example-index')
delete_response = index.delete(ids=['vec1', 'vec2'], namespace='example-namespace')
Index.describe_index_stats()
Index.describe_index_stats()
Returns statistics about the index's contents, including the vector count per namespace and the number of dimensions.
Returns:
namespaces : object A mapping for each namespace in the index from the namespace name to a
summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.
dimension : int64 The dimension of the indexed vectors.
indexFullness : float The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%.
totalVectorCount : int64 The total number of vectors in the index.
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-11
|
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
index = pinecone.Index('example-index')
index_stats_response = index.describe_index_stats()
Index.fetch()
Index.fetch(ids, **kwargs)
The Fetch operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and metadata.
ParametersTypeDescriptionids[str]The vector IDs to fetch. Does not accept values containing spaces.namespacestr(Optional) The namespace containing the vectors.
Returns:
vectors : object Contains the vectors.
namespace : string The namespace of the vectors.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
index = pinecone.Index('example-index')
fetch_response = index.fetch(ids=['vec1', 'vec2'], namespace='example-namespace')
Index.query()
Index.query(**kwargs)
Search a namespace using a query vector. Retrieves the ids of the most similar items in a namespace, along with their similarity scores.
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-12
|
ParametersTypeDescriptionnamespacestr(Optional) The namespace to query.top_kint64The number of results to return for each query.filterobject(Optional) The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/.include_valuesboolean(Optional) Indicates whether vector values are included in the response. Defaults to false.include_metadataboolean(Optional) Indicates whether metadata is included in the response as well as the ids. Defaults to false.vector[floats](Optional) The query vector. This should be the same length as the dimension of the index being queried. Each query() request can contain only one of the parameters id or vector.sparse_vectordictionary(Optional) The sparse query vector. This must contain an array of integers named indices and an array of floats named values. These two arrays must be the same length.idstring(Optional) The unique ID of the vector to be used as a query vector. Each query() request can contain only one of the parameters vector or id.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
index = pinecone.Index('example-index')
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-13
|
query_response = index.query(
namespace='example-namespace',
top_k=10,
include_values=True,
include_metadata=True,
vector=[0.1, 0.2, 0.3, 0.4],
filter={
'genre': {'$in': ['comedy', 'documentary', 'drama']}
}
)
The following example queries the index example-index with a sparse-dense vector.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index = pinecone.Index("example-index")
query_response = index.query(
namespace="example-namespace",
top_k=10,
include_values=True,
include_metadata=True,
vector=[0.1, 0.2, 0.3, 0.4],
sparse_vector={
'indices': [10, 45, 16],
'values': [0.5, 0.5, 0.2]
},
filter={
"genre": {"$in": ["comedy", "documentary", "drama"]}
}
)
Index.update()
Index.update(**kwargs)
Updates vectors in a namespace. If a value is included, it will overwrite the previous value.
If set_metadata is included, the values of the fields specified in it will be added or overwrite the previous value.
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-14
|
ParametersTypeDescriptionidstrThe vector's unique ID.values[float](Optional) Vector data.set_metadataobject(Optional) Metadata to set for the vector.namespacestr(Optional) The namespace containing the vector.
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
index = pinecone.Index('example-index')
update_response = index.update(
id='vec1',
values=[0.1, 0.2, 0.3, 0.4],
set_metadata={'genre': 'drama'},
namespace='example-namespace'
)
Index.upsert()
Index.upsert(**kwargs)
Writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value.
ParametersTypeDescriptionvectors[object]An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
id (str) - The vector's unique id.
values ([float]) - The vector data.
metadata (object) - (Optional) Metadata for the vector.
sparse_vector (object) - (Optional) A dictionary containing the index and values arrays containing the sparse vector values.namespacestr(Optional) The namespace name to upsert vectors.
Returns:
upsertedCount : int64 The number of vectors upserted.
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-15
|
Example:
Pythonimport pinecone
pinecone.init(api_key='YOUR_API_KEY', environment='YOUR_ENVIRONMENT')
index = pinecone.Index('example-index')
upsert_response = index.upsert(
vectors=[
{'id': "vec1", "values":[0.1, 0.2, 0.3, 0.4], "metadata": {'genre': 'drama'}},
{'id': "vec2", "values":[0.2, 0.3, 0.4, 0.5], "metadata": {'genre': 'action'}},
],
namespace='example-namespace'
)
The following example upserts vectors with sparse and dense values to example-index.
Pythonimport pinecone
pinecone.init(api_key="YOUR_API_KEY", environment="YOUR_ENVIRONMENT")
index = pinecone.Index("example-index")
|
https://docs.pinecone.io/docs/python-client
|
cc60f5f5e4a7-16
|
upsert_response = index.upsert(
vectors=[
{'id': 'vec1',
'values': [0.1, 0.2, 0.3, 0.4],
'metadata': {'genre': 'drama'},
'sparse_values': {
'indices': [10, 45, 16],
'values': [0.5, 0.5, 0.2]
}},
{'id': 'vec2',
'values': [0.2, 0.3, 0.4, 0.5],
'metadata': {'genre': 'action'},
'sparse_values': {
'indices': [15, 40, 11],
'values': [0.4, 0.5, 0.2]
}}
],
namespace='example-namespace'
)
Updated about 1 month ago LangChainNode.JS ClientDid this page help you?YesNo
|
https://docs.pinecone.io/docs/python-client
|
eb05f2902f12-0
|
This document describes how to monitor the usage and costs for your Pinecone organization through the Pinecone console.
To view your Pinecone usage, you must be the organization owner for your organization. This feature is only available to organizations on the Standard or Enterprise plans.
To view your usage through the Pinecone console, follow these steps:
Log in to the Pinecone console.
In the left menu, click Organizations.
Click the USAGE tab.
All dates are given in UTC to match billing invoices.Updated about 1 month ago Understanding costManage billingDid this page help you?YesNo
|
https://docs.pinecone.io/docs/monitoring-usage
|
20c69b6bb780-0
|
Overview
This category contains guides for tasks related to Pinecone billing.
Tasks
Setting up GCP Marketplace billing
Setting up AWS Marketplace billing
Changing your billing plan
Understanding subscription statuses
Updated 24 days ago Monitoring your usageUnderstanding subscription statusDid this page help you?YesNo
|
https://docs.pinecone.io/docs/manage-billing
|
91092c370872-0
|
Overview
This topic provides guidance on managing the cost of Pinecone. For the latest pricing details, see our pricing page. For help estimating total cost, see Understanding total cost. To see a calculation of your current usage and costs, see the usage dashboard in the Pinecone console.
The total cost of Pinecone usage derives from pod type, the number of pods in use, pod size, the total time each pod is running, and the billing plan. This topic describes several ways you can manage your overall Pinecone cost by adjusting these variables.
Use the Starter Plan for small projects or prototypes
The Starter Plan incurs no costs, and supports roughly 100,000 vectors with 1536 dimensions. If this meets the needs of your project, you can use Pinecone for free; if you decide to scale your index or move it to production, you can upgrade your billing plan later.
Choose the right pod size for your application
Different Pinecone pod sizes are designed for different applications, and some are more expensive than others. By choosing the appropriate pod type and size, you can pay for the resources you need. For example, the s1 pod type provides large storage capacity and lower overall costs with slightly higher query latencies than p1 pods. By switching to a different pod type, you may be able to reduce costs while still getting the performance your application needs.
Back up inactive indexes
|
https://docs.pinecone.io/docs/managing-cost
|
91092c370872-1
|
Back up inactive indexes
When a specific index is not in use, back it up using collections and delete the inactive index. When you're ready to use these vectors again, you can create a new index from the collection. This new index can also use a different index type or size. Because it's relatively cheap to store collections, you can reduce costs by only running an index when it's in use.
Use namespaces for multitenancy
If your application requires you to separate users into groups, consider using namespaces to isolate segments of vectors within a single index. Depending on your application requirements, this may allow you to reduce the total number of active indexes.
Commit to annual spend
Users who commit to an annual contract may qualify for discounted rates. To learn more, contact Pinecone sales.
Talk to support
Users on the Standard and Enterprise plans can contact support for help in optimizing costs.
Next steps
|
https://docs.pinecone.io/docs/managing-cost
|
91092c370872-2
|
Learn about choosing index type and size
Learn about monitoring usage
Updated about 1 month ago Understanding organizationsUnderstanding costDid this page help you?YesNo
|
https://docs.pinecone.io/docs/managing-cost
|
97a99c842e81-0
|
Overview
This topic describes the calculation of total cost for Pinecone, including an example. All prices are examples; for the latest pricing details, please see our pricing page. While our pricing page lists rates on an hourly basis for ease of comparison, this topic lists prices per minute, as this is how Pinecone calculates billing.
How does Pinecone calculate costs?
For each index, billing is determined by the per-minute price per pod and the number of pods the index uses, regardless of index activity. The per-minute price varies by pod type, pod size, account plan, and cloud region.
Total cost depends on a combination of factors:
Pod type. Each pod type has different per-minute pricing.
Number of pods. This includes replicas, which duplicate pods.
Pod size. Larger pod sizes have proportionally higher costs per minute.
Total pod-minutes. This includes the total time each pod is running, starting at pod creation and rounded up to 15-minute increments.
Cloud provider. The cost per pod-type and pod-minute varies depending on the cloud provider you choose for your project.
Collection storage. Collections incur costs per GB of data per minute in storage, rounded up to 15-minute increments.
Plan. The free plan incurs no costs; the Standard or Enterprise plans incur different costs per pod-type, pod-minute, cloud provider, and collection storage.
|
https://docs.pinecone.io/docs/understanding-cost
|
97a99c842e81-1
|
The following equation calculates the total costs accrued over time:
(Number of pods) * (pod size) * (number of replicas) * (minutes pod exists) * (pod price per minute)
(collection storage in GB) * (collection storage time in minutes) * (collection storage price per GB per minute)
To see a calculation of your current usage and costs, see the usage dashboard in the Pinecone console.
Example total cost calculation
An example application has the following requirements:
1,000,000 vectors with 1536 dimensions
150 queries per second with top_k = 10
Deployment in an EU region
Ability to store 1GB of inactive vectors
Based on these requirements, the organization chooses to configure the project to use the Standard billing plan to host one p1.x2 pod with two replicas and a collection containing 1 GB of data. This project runs continuously for the month of January on the Standard plan. The components of the total cost for this example are given in Table 1 below:
Table 1: Example billing components
|
https://docs.pinecone.io/docs/understanding-cost
|
97a99c842e81-2
|
Billing componentValueNumber of pods1Number of replicas3Pod sizex2Total pod count6Minutes in January44,640Pod-minutes (pods * minutes)267,840Pod price per minute$0.0012Collection storage1 GBCollection storage minutes44,640Price per storage minute$0.00000056
The invoice for this example is given in Table 2 below:
Table 2: Example invoice
ProductQuantityPrice per unitChargeCollections44,640$0.00000056$0.025P2 Pods (AWS)0$0.00P2 Pods (GCP)0$0.00S1 Pods0$0.00P1 Pods267,840$0.0012$514.29
Amount due $514.54
Cost controls
Pinecone offers tools to help you understand and control your costs.
Monitoring usage. Using the usage dashboard in the Pinecone console, you can monitor your Pinecone usage and costs as these accrue.
Pod limits. Pinecone project owners can set limits for the total number of pods across all indexes in the project. The default pod limit is 5.
Next steps
|
https://docs.pinecone.io/docs/understanding-cost
|
97a99c842e81-3
|
Next steps
Learn about choosing index type and size
Learn about monitoring usage
Updated about 1 month ago Managing costMonitoring your usageDid this page help you?YesNo
|
https://docs.pinecone.io/docs/understanding-cost
|
13b908d24904-0
|
Overview
A Pinecone organization is a set of projects that use the same billing. Organizations allow one or more users to control billing and project permissions for all of the projects belonging to the organization. Each project belongs to an organization.
For a guide to adding users to an organization, see Add users to a project or organization.
Projects in an organization
Each organization contains one or more projects that share the same organization owners and billing settings. Each project belongs to exactly one organization. If you need to move a project from one organization to another, contact Pinecone support.
Billing settings
All of the projects in an organization share the same billing method and settings. The billing settings for the organization are controlled by the organization owners.
Organization roles
There are two organization roles: organization owner and organization user.
Organization owners
Organization owners manage organization billing, users, and projects. Organization owners are also project owners for every project belonging to the organization. This means that organization owners have all permissions to manage project members, API keys, and quotas for these projects.
Organization users
Unlike organization owners, organization users cannot edit billing settings or invite new users to the organization. Organization users can create new projects, and project owners can add organization members to a project. New users have whatever role the organization owners and project owners grant them. Project owners can add users to a project if those users belong to the same organization as the project.
Table 1: Organization roles and permissions
|
https://docs.pinecone.io/docs/organizations
|
13b908d24904-1
|
Organization rolePermissions in organizationOrganization ownerProject owner for all projectsCreate projectsManage billingManags organization membersOrganization memberCreate projectsJoin projects when invitedRead access to billing
Organization single sign-on (SSO)
SSO allows organizations to manage their teams' access to Pinecone through their identity management solution. Once your integration is configured, you can require that users from your domain sign in through SSO, and you can specify a default role for teammates when they sign up. Only organizations in the enterprise tier can set up SSO. To set up your SSO integration, contact Pinecone support at support@pinecone.io.
Next steps
Add users to an organization
Updated 29 days ago Choosing index type and sizeManaging costDid this page help you?YesNo
|
https://docs.pinecone.io/docs/organizations
|
b05ea8e9b206-0
|
You can limit your vector search based on metadata. Pinecone lets you attach metadata key-value pairs to vectors in an index, and specify filter expressions when you query the index.
Searches with metadata filters retrieve exactly the number of nearest-neighbor results that match the filters. For most cases, the search latency will be even lower than unfiltered searches.
Searches without metadata filters do not consider metadata. To combine keywords with semantic search, see sparse-dense embeddings.
For more background information on metadata filtering, see: The Missing WHERE Clause in Vector Search.
Supported metadata types
You can associate a metadata payload with each vector in an index, as key-value pairs in a JSON object where keys are strings and values are one of:
String
Number (integer or floating point, gets converted to a 64 bit floating point)
Booleans (true, false)
List of String
ℹ️NoteHigh cardinality consumes more memory: Pinecone indexes metadata to allow
for filtering. If the metadata contains many unique values — such as a unique
identifier for each vector — the index will consume significantly more
memory. Consider using selective metadata indexing to avoid indexing
high-cardinality metadata that is not needed for filtering.
⚠️WarningNull metadata values are not supported. Instead of setting a key to hold a
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-1
|
null value, we recommend you remove that key from the metadata payload.
For example, the following would be valid metadata payloads:
JSON{
"genre": "action",
"year": 2020,
"length_hrs": 1.5
}
{
"color": "blue",
"fit": "straight",
"price": 29.99,
"is_jeans": true
}
Supported metadata size
Pinecone supports 40kb of metadata per vector.
Metadata query language
ℹ️NotePinecone's filtering query language is based on MongoDB's query and projection operators. We
currently support a subset of those selectors.
The metadata filters can be combined with AND and OR:
$eq - Equal to (number, string, boolean)
$ne - Not equal to (number, string, boolean)
$gt - Greater than (number)
$gte - Greater than or equal to (number)
$lt - Less than (number)
$lte - Less than or equal to (number)
$in - In array (string or number)
$nin - Not in array (string or number)
Using arrays of strings as metadata values or as metadata filters
A vector with metadata payload...
JSON{ "genre": ["comedy", "documentary"] }
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-2
|
...means the "genre" takes on both values.
For example, queries with the following filters will match the vector:
JSON{"genre":"comedy"}
{"genre": {"$in":["documentary","action"]}}
{"$and": [{"genre": "comedy"}, {"genre":"documentary"}]}
Queries with the following filter will not match the vector:
JSON{ "$and": [{ "genre": "comedy" }, { "genre": "drama" }] }
And queries with the following filters will not match the vector because they are invalid. They will result in a query compilation error:
# INVALID QUERY:
{"genre": ["comedy", "documentary"]}
# INVALID QUERY:
{"genre": {"$eq": ["comedy", "documentary"]}}
Inserting metadata into an index
Metadata can be included in upsert requests as you insert your vectors.
For example, here's how to insert vectors with metadata representing movies into an index:
PythonJavaScriptcurlimport pinecone
pinecone.init(api_key="your-api-key", environment="us-west1-gcp")
index = pinecone.Index("example-index")
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-3
|
index.upsert([
("A", [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1], {"genre": "comedy", "year": 2020}),
("B", [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2], {"genre": "documentary", "year": 2019}),
("C", [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3], {"genre": "comedy", "year": 2019}),
("D", [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4], {"genre": "drama"}),
("E", [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5], {"genre": "drama"})
])
await index.upsert({
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-4
|
])
await index.upsert({
vectors: [
{
id: "A",
values: [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
metadata: { genre: "comedy", year: 2020 },
},
{
id: "B",
values: [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2],
metadata: { genre: "documentary", year: 2019 },
},
{
id: "C",
values: [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
metadata: { genre: "comedy", year: 2019 },
},
{
id: "D",
values: [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4],
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-5
|
metadata: { genre: "drama" },
},
{
id: "E",
values: [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],
metadata: { genre: "drama" },
},
],
});
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/upsert \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"vectors": [
{
"id": "A",
"values": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
"metadata": {"genre": "comedy", "year": 2020}
},
{
"id": "B",
"values": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2],
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-6
|
"metadata": {"genre": "documentary", "year": 2019}
},
{
"id": "C",
"values": [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
"metadata": {"genre": "comedy", "year": 2019}
},
{
"id": "D",
"values": [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4],
"metadata": {"genre": "drama"}
},
{
"id": "E",
"values": [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],
"metadata": {"genre": "drama"}
}
]
}'
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-7
|
Projects on the gcp-starter environment do not support metadata strings containing the character Δ.
Querying an index with metadata filters
Metadata filter expressions can be included with queries to limit the search to only vectors matching the filter expression.
For example, we can search the previous movies index for documentaries from the year 2019. This also uses the include_metadata flag so that vector metadata is included in the response.
⚠️WarningFor performance reasons, do not return vector data and metadata when
top_k>1000. Queries with top_k over 1000 should not contain
include_metadata=True or include_data=True.
PythonJavaScriptindex.query(
vector=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
filter={
"genre": {"$eq": "documentary"},
"year": 2019
},
top_k=1,
include_metadata=True
)
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-8
|
# Returns:
# {'matches': [{'id': 'B',
# 'metadata': {'genre': 'documentary', 'year': 2019.0},
# 'score': 0.0800000429,
# 'values': []}],
# 'namespace': ''}
const queryResponse = await index.query({
vector: [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
filter: { genre: { $in: ["comedy", "documentary", "drama"] } },
topK: 1,
includeMetadata: true,
});
console.log(queryResponse.data);
// Returns:
// {'matches': [{'id': 'B',
// 'metadata': {'genre': 'documentary', 'year': 2019.0},
// 'score': 0.0800000429,
// 'values': []}],
// 'namespace': ''}
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-9
|
curlcurl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/query \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"vector": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
"filter": {"genre": {"$in": ["comedy", "documentary", "drama"]}},
"topK": 1,
"includeMetadata": true
}'
# Output:
# {
# "matches": [
# {
# "id": "B",
# "score": 0.0800000429,
# "values": [],
# "metadata": {
# "genre": "documentary",
# "year": 2019
# }
# }
# ],
# "namespace": ""
# }
More example filter expressions
A comedy, documentary, or drama:
JSON{
"genre": { "$in": ["comedy", "documentary", "drama"] }
}
A drama from 2020:
JSON{
"genre": { "$eq": "drama" },
"year": { "$gte": 2020 }
}
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-10
|
A drama from 2020 (equivalent to the previous example):
JSON{
"$and": [{ "genre": { "$eq": "drama" } }, { "year": { "$gte": 2020 } }]
}
A drama or a movie from 2020:
JSON{
"$or": [{ "genre": { "$eq": "drama" } }, { "year": { "$gte": 2020 } }]
}
|
https://docs.pinecone.io/docs/metadata-filtering
|
b05ea8e9b206-11
|
Deleting vectors by metadata filter
To specify vectors to be deleted by metadata values, pass a metadata filter expression to the delete operation. This deletes all vectors matching the metadata filter expression.
Projects in the gcp-starter region do not support deleting by metadata.
Example
This example deletes all vectors with genre "documentary" and year 2019 from an index.
PythonJavaScriptcurlindex.delete(
filter={
"genre": {"$eq": "documentary"},
"year": 2019
}
)
await index._delete({
filter: {
genre: { $eq: "documentary" },
year: 2019,
},
});
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/delete \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"filter": {"genre": {"$in": ["comedy", "documentary", "drama"]}}
}'
Updated 4 days ago Query dataUsing namespacesDid this page help you?YesNo
|
https://docs.pinecone.io/docs/metadata-filtering
|
ff471843e1bb-0
|
After your data is indexed, you can start sending queries to Pinecone.
The Query operation searches the index using a query vector. It retrieves the IDs of the most similar vectors in the index, along with their similarity scores. t can optionally include the result vectors' values and metadata too. You specify the number of vectors to retrieve each time you send a query. They are always ordered by similarity from most similar to least similar.
The similarity score for a vector represents its distance to the query vector, calculated according to the distance metric for the index. The significance of the score depends on the similarity metric: for example, for indexes using the euclidean distance metric, scores with lower values are more similar, while for indexes using the dotproduct metric, higher scores are more similar.
Sending a query
When you send a query, you provide a vector and retrieve the top-k most similar vectors for each query. For example, this example sends a query vector and retrieves three matching vectors:
PythonJavaScriptcurlindex.query(
vector=[0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
top_k=3,
include_values=True
)
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-1
|
# Returns:
# {'matches': [{'id': 'C',
# 'score': -1.76717265e-07,
# 'values': [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]},
# {'id': 'B',
# 'score': 0.080000028,
# 'values': [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]},
# {'id': 'D',
# 'score': 0.0800001323,
# 'values': [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]}],
# 'namespace': ''}
const index = pinecone.index("example-index");
const queryResponse = await Index.query({
query: {
vector: [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-2
|
topK: 3,
includeValues: true,
},
namespace: "example-namespace",
});
// Returns:
// {'matches': [{'id': 'C',
// 'score': -1.76717265e-07,
// 'values': [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]},
// {'id': 'B',
// 'score': 0.080000028,
// 'values': [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]},
// {'id': 'D',
// 'score': 0.0800001323,
// 'values': [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]}],
// 'namespace': ''}
curl -i -X POST https://hello-pinecone-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/query \
-H 'Api-Key: YOUR_API_KEY' \
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-3
|
-H 'Content-Type: application/json' \
-d '{
"vector":[0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
"topK": 3,
"includeValues": true
}'
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-4
|
# Output:
# {
# "matches":[
# {
# "id": "C",
# "score": -1.76717265e-07,
# "values": [0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.3]
# },
# {
# "id": "B",
# "score": 0.080000028,
# "values": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
# },
# {
# "id": "D",
# "score": 0.0800001323,
# "values": [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]
# }
# ],
# "namespace": ""
# }
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-5
|
Depending on your data and your query, you may not get top_k results. This happens when top_k is larger than the number of possible matching vectors for your query.
Querying by namespace
You can organize the vectors added to an index into partitions, or "namespaces," to limit queries and other vector operations to only one such namespace at a time. For more information, see: Namespaces.
Using metadata filters in queries
You can add metadata to document embeddings within Pinecone, and then filter for those criteria when sending the query. Pinecone will search for similar vector embeddings only among those items that match the filter. For more information, see: Metadata Filtering.
PythonJavaScriptcurlindex.query(
vector=[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
filter={
"genre": {"$eq": "documentary"},
"year": 2019
},
top_k=1,
include_metadata=True
)
const index = pinecone.index("example-index")
const queryResponse = await index.query({
query: {
vector: [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-6
|
topK: 1,
includeMetadata: true
filters: {
"genre": {"$eq": "documentary"}
},
}
})
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-7
|
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/query \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"vector": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
"filter": {"genre": {"$in": ["comedy", "documentary", "drama"]}},
"topK": 1,
"includeMetadata": true
}'
Querying vectors with sparse and dense values
When querying an index containing sparse and dense vectors, use the query() operation with the sparse_vector parameter present.
⚠️WarningThe Update operation does not validate the existence of ids within an
index. If a non-existent id is given then no changes are made and a 200 OK
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-8
|
will be returned.
Examples
The following example queries the index example-index with a sparse-dense vector.
Pythoncurlquery_response = index.query(
namespace="example-namespace",
top_k=10,
vector=[0.1, 0.2, 0.3, 0.4],
sparse_vector={
'indices': [10, 45, 16],
'values': [0.5, 0.5, 0.2]
}
)
curl --request POST \
--url https://index_name-project_id.svc.environment.pinecone.io/query \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"includeValues": "false",
"includeMetadata": "false",
"vector": [
0.1,
0.2,
0.3,
0.4
],
"sparseVector": {
"indices": [
10,
45,
16
],
"values": [
0.5,
0.5,
0.2
]
},
"topK": 10,
"namespace": "example-namespace"
}
'
|
https://docs.pinecone.io/docs/query-data
|
ff471843e1bb-9
|
Limitations
Avoid returning vector data and metadata when top_k is greater than 1000. This means queries with top_k over 1000 should not contain include_metadata=True or include_data=True. For more limitations, see: Limits.Updated 5 days ago Sparse-dense embeddingsFiltering with metadataDid this page help you?YesNo
|
https://docs.pinecone.io/docs/query-data
|
089cf6017e8f-0
|
In addition to inserting and querying data, there are other ways you can interact with vector data in a Pinecone index. This section walks through the various vector operations available.
Connect to an index
If you're using a Pinecone client library to access an index, you'll need to open a session with the index:
PythonJavaScriptcurl# Connect to the index
index = pinecone.Index("pinecone-index")
const index = pinecone.Index("pinecone-index");
# Not applicable
Specify an index endpoint
Pinecone indexes each have their own DNS endpoint. For cURL and other direct
API calls to a Pinecone index, you'll need to know the dedicated endpoint for
your index.
Index endpoints take the following form:
https://{index-name}-{project-name}.svc.YOUR_ENVIRONMENT.pinecone.io
{index-name} is the name you gave your index when you created it.
{project-name} is the Pinecone project name that your API key is associated
with. This can be retrieved using the whoami operation below.
YOUR_ENVIRONMENT is the cloud region for your Pinecone project..
Call whoami to retrieve your project name.
The following command retrieves your Pinecone project name.
Pythoncurlpinecone.whoami()
curl -i https://controller.YOUR_ENVIRONMENT.pinecone.io/actions/whoami -H 'Api-Key: YOUR_API_KEY'
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-1
|
Describe index statistics
Get statistics about an index, such as vector count per namespace:
PythonJavaScriptcurlindex.describe_index_stats()
const index = pinecone.Index("pinecone-index");
const indexStats = await index.describeIndexStats();
console.log(indexStats.data);
curl -i -X GET https://YOUR_INDEX-PROJECT_NAME.svc.YOUR_ENVIRONMENT.pinecone.io/describe_index_stats \
-H 'Api-Key: YOUR_API_KEY'
Fetching vectors
The Fetch operation looks up and returns vectors, by id, from an index. The returned vectors include the vector data and/or metadata. Typical fetch latency is under 5ms.
Fetch items by their ids:
PythonJavaScriptcurlindex.fetch(["id-1", "id-2"])
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-2
|
# Returns:
# {'namespace': '',
# 'vectors': {'id-1': {'id': 'id-1',
# 'values': [0.568879, 0.632687092, 0.856837332, ...]},
# 'id-2': {'id': 'id-2',
# 'values': [0.00891787093, 0.581895, 0.315718859, ...]}}}
const fetchedVectors = await index.fetch(["id-1", "id-2"]);
// Returns:
// {'namespace': '',
// 'vectors': {'id-1': {'id': 'id-1',
// 'values': [0.568879, 0.632687092, 0.856837332, ...]},
// 'id-2': {'id': 'id-2',
// 'values': [0.00891787093, 0.581895, 0.315718859, ...]}}}
curl -i -X GET "https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/fetch?ids=id-1&ids=id-2" \
-H 'Api-Key: YOUR_API_KEY'
# Output:
# {
# "vectors": {
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-3
|
# "vectors": {
# "id-1": {
# "id": "id-1",
# "values": [0.568879, 0.632687092, 0.856837332, ...]
# },
# "id-2": {
# "id": "id-2",
# "values": [0.00891787093, 0.581895, 0.315718859, ...]
# }
# },
# "namespace": ""
# }
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-4
|
Updating vectors
There are two methods for updating vectors and metadata, using full or partial updates.
Full update
Full updates modify the entire item, that is vectors and metadata. Updating an item by id is done the same way as inserting items. (Write operations in Pinecone are idempotent.)
The Upsert operation writes vectors into an index.
ℹ️NoteIf a new value is upserted for an existing vector id, it will overwrite the
previous value.
Update the value of the item ("id-3", [3.3, 3.3]):
PythonJavaScriptcurlindex.upsert([("id-3", [3.3, 3.3])])
await index.upsert({
vectors: [
{
id: "id-0",
values: [3.3, 3.3],
},
],
});
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/upsert \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"vectors": [
{
"id": "id-0",
"values": [3.3, 3.3]
}
]
}'
Fetch the item again. We should get ("id-3", [3.3, 3.3]):
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-5
|
PythonJavaScriptcurlindex.fetch(["id-3"])
const fetchedVectors = await index.fetch(["id-3"]);
curl -i -X GET https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/fetch?ids=id-3 \
-H 'Api-Key: YOUR_API_KEY'
Partial update
The Update operation performs partial updates that allow changes to part of an item. Given an id, we can update the vector value with the values argument or update metadata with the set_metadata argument.
⚠️WarningThe Update operation does not validate the existence of ids within an
index. If a non-existent id is given then no changes are made and a 200 OK
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-6
|
will be returned.
To update the value of item ("id-3", [3., 3.], {"type": "doc", "genre": "drama"}):
PythonJavaScriptcurlindex.update(id="id-3", values=[4., 2.])
await index.update({
id: "id-3",
values: [4, 2],
});
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/update \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"id": "id-3",
"values": [
3.3,
3.3
]
}'
The updated item would now be ("id-3", [4., 2.], {"type": "doc", "genre": "drama"}).
When updating metadata only specified fields will be modified. If a specified field does not exist, it is added.
ℹ️NoteMetadata updates apply only to fields passed to the set_metadata
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-7
|
argument. Any other fields will remain unchanged.
To update the metadata of item ("id-3", [4., 2.], {"type": "doc", "genre": "drama"}):
PythonJavaScriptcurlindex.update(id="id-3", set_metadata={"type": "web", "new": "true"})
await index.update({
id: "id-3",
setMetadata: {
type: "web",
new: "true",
},
});
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/update \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"id": "id-3",
"setMetadata": {
"type": "web",
"new": "true"
}
}'
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-8
|
The updated item would now be ("id-3", [4., 2.], {"type": "web", "genre": "drama", "new": "true"}).
Both vector and metadata can be updated at once by including both values and set_metadata arguments. To update the "id-3" item we write:
PythonJavaScriptcurlindex.update(id="id-3", values=[1., 2.], set_metadata={"type": "webdoc"})
await index.update({
id: "id-3",
values: [1, 2],
setMetadata: {
type: "webdoc",
},
});
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/update \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"id": "id-3",
"values": [1., 2.],
"set_metadata": {"type": "webdoc"}
}
}'
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-9
|
The updated item would now be ("id-3", [1., 2.], {"type": "webdoc", "genre": "drama", "new": "true"}).
Deleting vectors
The Delete operation deletes vectors, by ID, from an index.
Alternatively, it can also delete all vectors from an index or namespace.
When deleting large numbers of vectors, limit the scope of delete operations to hundreds of vectors per operation.
Instead of deleting all vectors in an index, delete the index and recreate it.
Delete vectors by ID
To delete vectors by their IDs, specify an ids parameter to delete. The ids parameter is an array of strings containing vector IDs.
Example
PythonJavaScriptcurlindex.delete(ids=["id-1", "id-2"], namespace='example-namespace')
await index.delete1(["id-1", "id-2"], false, "example-namespace");
curl -i -X DELETE "https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io.pinecone.io/vectors/delete?ids=id-1&ids=id-2&namespace=example-namespace" \
-H 'Api-Key: YOUR_API_KEY'
Delete vectors by namespace
To delete all vectors from a namespace, specify deleteAll='true' and provide a
namespace parameter.
ℹ️NoteIf you delete all vectors from a single namespace, it will also delete the
|
https://docs.pinecone.io/docs/manage-data
|
089cf6017e8f-10
|
namespace.
Projects on the gcp-starter environment do not support the deleteAll parameter.
Example:
PythonJavaScriptcurlindex.delete(deleteAll='true', namespace='example-namespace')
await index.delete1([], true, "example-namespace");
curl -i -X DELETE "https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/delete?deleteAll=true&namespace=example-namespace" \
-H 'Api-Key: YOUR_API_KEY'
Delete vectors by metadata
To delete vectors by metadata, pass a metadata filter expression to the delete operation.Updated 19 days ago Insert dataSparse-dense embeddingsDid this page help you?YesNo
|
https://docs.pinecone.io/docs/manage-data
|
b55bd8ef143b-0
|
After creating a Pinecone index, you can start inserting vector embeddings and metadata into the index.
Inserting the vectors
Connect to the index:
Pythoncurlindex = pinecone.Index("pinecone-index")
# Not applicable
Insert the data as a list of (id, vector) tuples. Use the Upsert operation to write vectors into a namespace:
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-1
|
PythonJavaScriptcurl# Insert sample data (5 8-dimensional vectors)
index.upsert([
("A", [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]),
("B", [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]),
("C", [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]),
("D", [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]),
("E", [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5])
])
index.upsert({
vectors: [
{
id: "A",
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-2
|
{
id: "A",
values: [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
},
{
id: "B",
values: [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2],
},
{
id: "C",
values: [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
},
{
id: "D",
values: [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4],
},
{
id: "E",
values: [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],
},
],
});
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-3
|
},
],
});
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/upsert \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"vectors": [
{
"id": "A",
"values": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
},
{
"id": "B",
"values": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
},
{
"id": "C",
"values": [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]
},
{
"id": "D",
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-4
|
"id": "D",
"values": [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]
},
{
"id": "E",
"values": [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
}
]
}'
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-5
|
Immediately after the upsert response is received, vectors may not be visible to queries yet. In most situations, you can check if the vectors have been received by checking for the vector counts returned by describe_index_stats() to be updated. This technique may not work if the index has multiple replicas. The database is eventually consistent.
Batching upserts
For clients upserting larger amounts of data, you should insert data into an index in batches of 100 vectors or fewer over multiple upsert requests.
Example
Pythonimport random
import itertools
def chunks(iterable, batch_size=100):
"""A helper function to break an iterable into chunks of size batch_size."""
it = iter(iterable)
chunk = tuple(itertools.islice(it, batch_size))
while chunk:
yield chunk
chunk = tuple(itertools.islice(it, batch_size))
vector_dim = 128
vector_count = 10000
# Example generator that generates many (id, vector) pairs
example_data_generator = map(lambda i: (f'id-{i}', [random.random() for _ in range(vector_dim)]), range(vector_count))
# Upsert data with 100 vectors per upsert request
for ids_vectors_chunk in chunks(example_data_generator, batch_size=100):
index.upsert(vectors=ids_vectors_chunk) # Assuming `index` defined elsewhere
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-6
|
Sending upserts in parallel
By default, all vector operations block until the response has been received. But using our client they can be made asynchronous. For the Batching Upserts example this can be done as follows:
PythonShell# Upsert data with 100 vectors per upsert request asynchronously
# - Create pinecone.Index with pool_threads=30 (limits to 30 simultaneous requests)
# - Pass async_req=True to index.upsert()
with pinecone.Index('example-index', pool_threads=30) as index:
# Send requests in parallel
async_results = [
index.upsert(vectors=ids_vectors_chunk, async_req=True)
for ids_vectors_chunk in chunks(example_data_generator, batch_size=100)
]
# Wait for and retrieve responses (this raises in case of error)
[async_result.get() for async_result in async_results]
# Not applicable
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-7
|
Pinecone is thread-safe, so you can launch multiple read requests and multiple write requests in parallel. Launching multiple requests can help with improving your throughput. However, reads and writes can’t be performed in parallel, therefore writing in large batches might affect query latency and vice versa.
If you experience slow uploads, see Performance tuning for advice.
Partitioning an index into namespaces
You can organize the vectors added to an index into partitions, or "namespaces," to limit queries and other vector operations to only one such namespace at a time. For more information, see: Namespaces.
Inserting vectors with metadata
You can insert vectors that contain metadata as key-value pairs.
You can then use the metadata to filter for those criteria when sending the query. Pinecone will search for similar vector embeddings only among those items that match the filter. For more information, see: Metadata Filtering.
PythonJavaScriptcurlindex.upsert([
("A", [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1], {"genre": "comedy", "year": 2020}),
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-8
|
("B", [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2], {"genre": "documentary", "year": 2019}),
("C", [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3], {"genre": "comedy", "year": 2019}),
("D", [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4], {"genre": "drama"}),
("E", [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5], {"genre": "drama"})
])
await index.upsert({
vectors: [
{
id: "A",
values: [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-9
|
metadata: { genre: "comedy", year: 2020 },
},
{
id: "B",
values: [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2],
metadata: { genre: "documentary", year: 2019 },
},
{
id: "C",
values: [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
metadata: { genre: "comedy", year: 2019 },
},
{
id: "D",
values: [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4],
metadata: { genre: "drama" },
},
{
id: "E",
values: [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],
|
https://docs.pinecone.io/docs/insert-data
|
b55bd8ef143b-10
|
metadata: { genre: "drama" },
},
],
});
curl -i -X POST https://YOUR_INDEX-YOUR_PROJECT.svc.YOUR_ENVIRONMENT.pinecone.io/vectors/upsert \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"vectors": [
{
"id": "A",
"values": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
"metadata": {"genre": "comedy", "year": 2020}
},
{
"id": "B",
"values": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2],
"metadata": {"genre": "documentary", "year": 2019}
},
{
"id": "C",
"values": [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
|
https://docs.pinecone.io/docs/insert-data
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 22