POST
/
query
curl https://better-dodo-20522-us1-vector.upstash.io/query \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{ "vector": [0.42,0.63,0.05,0.72,0.83,0.49,0.6,0.48],
		"topK": 2,
  		"includeVectors": true,
  		"includeMetadata": true
	}'
{
  "result" : [ 
	{
	    "id" : "id12",
	    "score" : 1.0,
	    "vector" : [ 0.42, 0.63, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48 ],
	    "metadata" : {"key":"value"}
  	}, 
	{
	    "id" : "id11",
	    "score" : 0.99996454,
	    "vector" : [ 0.44, 0.63, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48 ],
	    "metadata" : {"key":"value"}
  	} 
  ]
}

Request

vector
number[]
required

The query vector

The provided vector should have the same number of dimensions as your index.

topK
number
required

The total number of the vectors that you want to recieve as a query result. The response will be sorted based on the distance metric score, and topK vectors will be returned.

includeMetadata
boolean

Whether to include the metadata of the vectors in the response. Setting this true would be the best practice, since it will make it easier to identify the vectors.

includeVectors
boolean

Whether to include the vector data of the resulting vectors.

Response

Response
Array
curl https://better-dodo-20522-us1-vector.upstash.io/query \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{ "vector": [0.42,0.63,0.05,0.72,0.83,0.49,0.6,0.48],
		"topK": 2,
  		"includeVectors": true,
  		"includeMetadata": true
	}'
{
  "result" : [ 
	{
	    "id" : "id12",
	    "score" : 1.0,
	    "vector" : [ 0.42, 0.63, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48 ],
	    "metadata" : {"key":"value"}
  	}, 
	{
	    "id" : "id11",
	    "score" : 0.99996454,
	    "vector" : [ 0.44, 0.63, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48 ],
	    "metadata" : {"key":"value"}
  	} 
  ]
}