Query
operation searches the index using a query vector. It retrieves the IDs of the most similar records in the index, along with their similarity scores. This operation can optionally return the result’s vector values and metadata, too. You specify the number of vectors to retrieve each time you send a query. Matches are always ordered by similarity from most similar to least similar.
The similarity score for a vector represents its distance to the query vector, calculated according to the distance metric for the index. The significance of the score depends on the similarity metric. For example, for indexes using the euclidean
distance metric, scores with lower values are more similar, while for indexes using the dotproduct
metric, higher scores are more similar.
top_k
parameter indicates the number of results to return. For example, this example sends a query vector and retrieves three matching vectors:
top_k
results. This happens when top_k
is larger than the number of possible matching vectors for your query.
sparse_vector
in your query parameters.
Examples
The following example shows how to query with a sparse-dense vector.
top_k
is greater than 1000. This means queries with top_k
over 1000 should not contain include_metadata=True
or include_data=True
. For more limitations, see: Limits.
Pinecone is eventually consistent, so queries may not reflect very recent upserts.