Postman Response Error

Hello All,

To date I have (In the Pinecone playground):

  1. Created an index
  2. Added data to my index
  3. Queried my data

Problem: I cannot query my data in postman. How do I resolve this?

Request URL: https://hello-world-aa80a86.svc.us-west1-gcp.pinecone.io/query ?Content-Type=application/json
Request Method: POST
Request Body
{
“vector”: [0.1, 0.1, 0.1],
“filter”: {“genre”: {“$in”: [“comedy”, “documentary”, “drama”]}},
“topK”: 1,
“includeMetadata”: true
}

I am receiving a 200 status code but in the response body it only shows “1” as shown in the picture

I have already read the docs (Query data)

I suspect the filter is causing it to return 0 results. Does the data you inserted contain those metadata fields? If not, remove the filter section and try again.

I tried removing and same thing.

In the Pinecone playground this works:
{
“topK”: 10,
“includeMetadata”: true,
“namespace”: “example_namespace”,
“queries”: [
{
“filter”: {
“colors”: {
“$eq”: “pink”
}
},
“values”: [
0.8122945324233461,
0.07425692029520642,
0.24591363802869184
]
}
]

In Postman it doesn’t

Expected result:
{
“results”: [
{
“matches”: [
{
“id”: “item_9”,
“score”: 0.855569899,
“values”: ,
“sparseValues”: {},
“metadata”: {
“category”: “sports”,
“colors”: [
“pink”,
“green”,
“blue”
],
“time_stamp”: 0.9
}
},
{
“id”: “item_7”,
“score”: 0.720533311,
“values”: ,
“sparseValues”: {},
“metadata”: {
“category”: “music”,
“colors”: [
“purple”,
“green”,
“pink”
],
“time_stamp”: 0.7
}
},
{
“id”: “item_5”,
“score”: 0.471467674,
“values”: ,
“sparseValues”: {},
“metadata”: {
“category”: “sports”,
“colors”: [
“green”,
“pink”,
“red”
],
“time_stamp”: 0.5
}
}
],
“namespace”: “example_namespace”
}
],
“matches”: ,
“namespace”: “”
}

Current Result:
1

Can you compare the curl request example when you click </> in Postman versus the curl command in the Pinecone playground/console? The below example is fake but shows the full request from my own Postman:

curl --location ‘https://squad-2a849c7.svc.us-east-1-aws.pinecone.io/query
–header ‘Api-Key: fb1b70bc-c702-4248-bb72-1fcd50f03616’
–header ‘Content-Type: application/json’
–data ‘{“queries”:[{“values”:[
-0.174141511,
-0.0848834,
0.0180412345
]}],“topK”:100,“includeMetadata”:false,“includeValues”:false}’

Try comparing that to the curl request inside the Pinecone console to see if there is a difference.

Screenshot 2023-02-21 at 2.00.23 PM

Ok will try again.

I’m literally copying what’s in the Pinecone console to postman.

The request is successful but the response body is as I’ve shown

Ensure that the URL is correct.

I put the content-type as a parameter, ensure it’s in the header

Hello! :earth_africa:

About the Issue

  • When the path following Pinecone’s service domain (.svc.us-east1-gcp.pinecone.io) is not valid, an HTTP 200 OK with an empty Body appears to be returned. (This assumes that the Api-Key is correctly set). In this case, even if the value of the POST Body is an invalid string (text/plain), an HTTP 200 is still returned.

  • If the URL is correct and there is a problem with the Body, HTTP 400 should be returned.

Solution

  • Remove the ?Content-Type=application/json from the Query Parameters.
  • Set the Content-Type in the Header. (Even if the Content-Type is set to text/plain, it will work if the Body is in JSON)