Blank results and matches from CURL PHP pinecone request

Background: I’m a PM, not a developer, and trying to learn more about embeddings and RAG through a side project.

Problem: Trying to query from via CURL/PHP, but getting a blank response.

Here’s what I’m getting back:

HTTP Code: 200
{“results”:,“matches”:,“namespace”:“default”,“usage”:{“readUnits”:1}}

I’m sending:

Payload to Pinecone: {“vector”:[-0.026489232,-0.012701751… 64359],“top_k”:5,“namespace”:“default”}

I don’t understand why there are no results.

I’ve verified that the index is no empty. I’ve checked the length of the vector. I’m asking questions that should get results. Here’s the code:

// Set up cURL to send the request to Pinecone

$headers = [

'Api-Key: ’ . $pineconeApiKey,

‘Content-Type: application/json’,

];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $pineconeEndpoint);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

// Execute the request

$response = curl_exec($ch);

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

Any assistance is most appreciated!

Hi @andrewleepost! My first thought is that you’re querying the wrong namespace. Can you try sending the response with no namespace parameter?

If that doesn’t work, can you use the describe_index_stats operation to get a list of all of the namespaces in your index? Then I can try to help you troubleshoot from there.

1 Like

I commented out the namespace, and I got a response! Thank you.

I think I have to work through the next issue, which is that I don’t seem to have metadata in the response.