Operations (sample payloads)
Main operationsCopy
Create indexCopy
This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more.
Sample Input
1{2"name": "product-embeddings",3"dimension": 768,4"metric": "cosine",5"spec": {6"pod": {7"environment": "gcp-starter",8"pod_type": "p1.x1",9"replicas": 1,10"shards": 1,11"pods": 1,12"metadata_config": {13"indexed": [14"category",15"brand",16"price"17]18}19}20}21}
Sample Output
1{2"name": "product-embeddings",3"dimension": 768,4"metric": "cosine",5"host": "product-embeddings-12345.svc.gcp-starter.pinecone.io",6"spec": {7"pod": {8"environment": "gcp-starter",9"replicas": 1,10"shards": 1,11"pod_type": "p1.x1",12"pods": 1,13"metadata_config": {14"indexed": [15"category",16"brand",17"price"18]19},20"source_collection": ""21}22},23"status": {24"ready": true,25"state": "Ready"26}27}
Delete vectorsCopy
The delete operation deletes vectors, by id, from a single namespace.
Sample Input
1{2"index_host": "my-index-123456.svc.us-west1-gcp.pinecone.io",3"ids": [4"vec1",5"vec2",6"vec3"7],8"namespace": "product_catalog",9"filter": {10"category": "electronics",11"price": {12"$gt": 50013}14}15}
Sample Output
1{2"deleted": true3}
Get indexCopy
Get a description of an index.
Sample Input
1{2"index_name": "my-product-catalog"3}
Sample Output
1{2"name": "my-product-catalog",3"dimension": 1536,4"metric": "cosine",5"host": "my-product-catalog-12345.svc.us-west1-gcp.pinecone.io",6"spec": {7"pod": {8"environment": "gcp-starter",9"replicas": 1,10"shard": 1,11"pod_type": "p1.x1",12"pods": 1,13"metadata_config": {14"indexed": [15"category",16"brand"17],18"source_collection": "products"19}20}21},22"status": {23"ready": true,24"state": "Ready"25}26}
Get index statsCopy
The describe_index_stats operation returns statistics about the contents of an index, including the vector count per namespace and the number of dimensions, and the index fullness.
Sample Input
1{2"index_host": "my-index-123456.svc.us-west1-gcp.pinecone.io",3"filter": {4"genre": "science fiction",5"year": {6"$gte": 20007}8}9}
Sample Output
1{2"namespaces": {3"default": {4"vector_count": 100005},6"movies": {7"vector_count": 50008}9},10"dimension": 1536,11"index_fullness": 0.75,12"total_vector_count": 1500013}
List indexesCopy
This operation returns a list of all indexes in a project.
Sample Input
1{}
Sample Output
1{2"indexes": [3{4"name": "product-catalog",5"dimension": 512,6"metric": "cosine",7"host": "product-catalog-12345.svc.us-west1-gcp.pinecone.io",8"spec": {9"pod": {10"environment": "gcp-starter",11"replicas": 1,12"shards": 1,13"pod_type": "s1.x1",14"pods": 1,15"metadata_config": {16"indexed": [17"category",18"brand",19"price"20]21},22"source_collection": ""23}24},25"status": {26"ready": true,27"state": "Ready"28}29},30{31"name": "customer-embeddings",32"dimension": 768,33"metric": "euclidean",34"host": "customer-embeddings-67890.svc.us-east1-aws.pinecone.io",35"spec": {36"serverless": {37"cloud": "aws",38"region": "us-east-1"39}40},41"status": {42"ready": true,43"state": "Ready"44}45}46]47}
Query vectorsCopy
The query operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores.
Sample Input
1{2"index_host": "my-index-123456.svc.us-west1-gcp.pinecone.io",3"namespace": "products",4"topK": 3,5"filter": {6"category": "electronics",7"price": {8"$lte": 10009}10},11"includeValues": true,12"includeMetadata": true,13"vector": [140.1,150.2,160.3,170.4,180.519]20}
Sample Output
1{2"matches": [3{4"id": "prod_001",5"score": 0.95,6"values": [70.11,80.21,90.31,100.41,110.5112],13"metadata": {14"name": "Smartphone X",15"category": "electronics",16"price": 799.9917}18},19{20"id": "prod_002",21"score": 0.87,22"values": [230.12,240.22,250.32,260.42,270.5228],29"metadata": {30"name": "Laptop Y",31"category": "electronics",32"price": 999.9933}34},35{36"id": "prod_003",37"score": 0.82,38"values": [390.13,400.23,410.33,420.43,430.5344],45"metadata": {46"name": "Tablet Z",47"category": "electronics",48"price": 599.9949}50}51],52"namespace": "products",53"usage": {54"readUnits": 355}56}
Upsert vectorsCopy
The upsert operation writes vectors into a namespace. If a new value is upserted for an existing vector id, it will overwrite the previous value.
Sample Input
1{2"index_host": "my-index-123abc.svc.us-east-1-aws.pinecone.io",3"vectors": [4{5"id": "vec1",6"values": [70.1,80.2,90.3,100.4,110.512],13"sparseValues": {14"indices": [151,163,17518],19"values": [200.5,210.8,220.223]24},25"metadata": {26"category": "electronics",27"price": 299.9928}29},30{31"id": "vec2",32"values": [330.6,340.7,350.8,360.9,37138],39"metadata": {40"category": "clothing",41"size": "medium"42}43}44],45"namespace": "product_catalog"46}
Sample Output
1{2"upsertedCount": 23}