Search with text
Searching with text is supported only for indexes with integrated embedding.
search_records
operation with the following parameters:
- The
namespace
to query. To use the default namespace, set the namespace to"__default__"
. - The
query.inputs.text
parameter with the query text. Pinecone uses the embedding model integrated with the index to convert the text to a dense vector automatically. - The
query.top_k
parameter with the number of similar records to return. - Optionally, you can specify the
fields
to return in the response. If not specified, the response will include all fields.
Search with a dense vector
To search a dense index with a dense vector representation of a query, use thequery
operation with the following parameters:
- The
namespace
to query. To use the default namespace, set the namespace to"__default__"
. - The
vector
parameter with the dense vector values representing your query. - The
top_k
parameter with the number of results to return. - Optionally, you can set
include_values
and/orinclude_metadata
totrue
to include the vector values and/or metadata of the matching records in the response. However, when querying withtop_k
over 1000, avoid returning vector data or metadata for optimal performance.
example-namespaces
namespace:
Search with a record ID
When you search with a record ID, Pinecone uses the dense vector associated with the record as the query. To search a dense index with a record ID, use thequery
operation with the following parameters:
- The
namespace
to query. To use the default namespace, set the namespace to"__default__"
. - The
id
parameter with the unique record ID containing the vector to use as the query. - The
top_k
parameter with the number of results to return. - Optionally, you can set
include_values
and/orinclude_metadata
totrue
to include the vector values and/or metadata of the matching records in the response. However, when querying withtop_k
over 1000, avoid returning vector data or metadata for optimal performance.
example-namespace
namespace that are most semantically similar to the dense vector in the record:
Parallel queries
Python SDK v6.0.0 and later provideasync
methods for use with asyncio. Async support makes it possible to use Pinecone with modern async web frameworks such as FastAPI, Quart, and Sanic, and can significantly increase the efficiency of running queries in parallel. For more details, see the Async requests.