Skip to main content
Full-text search matches exact terms: IDs, SKUs, error codes, and phrases. Create an index, load a few documents, and run a keyword (BM25) search in about five minutes.

Prerequisites

  • A Pinecone account and API key (get one).
  • Python 3.10+.
  • The Pinecone Python SDK: pip install --upgrade pinecone.
1

Set your API key

Set your API key as an environment variable so the SDK can authenticate:
2

Create an index

Define a schema with a full-text (BM25) field, then create the index. Only search fields belong in the schema; filterable metadata like category goes in the documents and is indexed automatically.
3

Load sample documents

Each document is a JSON object with a required _id, the text field from your schema (indexed for full-text search), and any metadata you want to attach. Here, category is metadata: it’s not declared in the schema, but Pinecone indexes it automatically so you can filter on it.These five short strings are just samples. Real documents can carry many metadata fields (up to 40 KB per document), plus dense- or sparse-vector fields if your schema declares them, and you can upsert up to 1,000 per request.
4

Run a full-text search

Search the index by choosing a scoring type with score_by. Here, type: "text" scores documents by BM25 keyword relevance on the text field, so an exact identifier like E1042 surfaces the record that contains it.
To narrow results, add a filter such as {"category": {"$eq": "product"}}. For exact phrase matching, use a query_string search instead (see the query syntax reference).

Use your own data

Swap the sample documents for your own: keep the same documents.upsert() call and replace the text and metadata with your content. Each document needs a unique _id and the text field from your schema, plus any metadata fields you want to filter on.
For large sets, use Bulk import instead of upserting one request at a time.

Next steps

Rank by meaning

Add a dense_vector field to your schema for semantic search, or combine it with text for hybrid search.

Ingest your own files

Embed your own files with Pinecone Inference and search by meaning

Bring your own vectors

Upsert embeddings you already have directly.
For the full reference (query syntax, filters, analyzers, and bulk import), see the Full-text search guide.