Query Data
Queries the approximate nearest neighbors of a raw text data after embedding it.
To use this endpoint, the index must be created with an embedding model.
Query will run against the default namespace by default. You can use a different namespace by specifying it in the request path.
Request
It is also possible to send a batch query request by providing an array of fields below.
The raw text data to embed and query.
The total number of the vectors that you want to receive as a query
result. The response will be sorted based on the distance metric score,
and at most topK
many vectors will be returned.
Whether to include the metadata of the vectors in the response, if any.
It is recommended to set this to true
to easily identify vectors.
Whether to include the vector values in the response.
It is recommended to set this to false
as the vector values can be
quite big, and not needed most of the time.
Whether to include the data of the vectors in the response. When set to true, data will contain the raw text data used while upserting.
Metadata filter to apply.
Path
The namespace to use. When no namespace is specified, the default namespace will be used.
Response
If the request was an array of a single element, or a JSON object, an object with the following fields is returned.
If the request was an array of more than one items, an array of objects below is returned, one for each query item.
The score is normalized to always be between 0 and 1. The closer the score is to 1, the more similar the vector is to the query vector. This does not depend on the distance metric you use.
The id of the vector.
The similarity score of the vector, calculated based on the distance metric of your index.
The vector value.
The metadata of the vector, if any.
The textual data of the vector before embedding it.
Was this page helpful?