Skip to main content
The Documents API is how you read and write data in Pinecone Database. It’s built for agents and search apps that need to find an exact identifier as reliably as a concept. An embedding model can’t reliably tell one SKU, error code, or order number from a similar one, so a vector search on its own can return the wrong result without raising an error. One document index serves both keyword (full-text) search and semantic search, so you don’t need a separate keyword engine to keep in sync with your vectors. You don’t have to generate embeddings yourself. When a text field declares embed, Pinecone embeds the text when you upsert it and embeds your query when you search. You can also bring your own dense or sparse vectors.

Index schema

Each document is a JSON object with fields you name, such as title or category. The index schema, set when you create the index, declares which fields are searchable and how: A schema can declare several text fields, such as a title and a body, each with its own text processing settings for language, stemming, stop words, or n-grams. One string field can also declare both full_text_search and embed, so the same text is searchable by keyword and by meaning. To design the fields for your own data, see Data modeling.

Search a document index

Each search request ranks results by the clauses in score_by, and an optional filter narrows the candidates first. You can run these types of search: Full-text clauses can be combined in one request, but a vector or embedding clause must be the only one. Any search can also filter on metadata, such as {"category": {"$eq": "accessories"}}. In this example, the first search is a full-text search for an exact model number. The second is a semantic search with integrated embedding, filtered to accessories whose title contains that number:
Python
The first search returns both KB-1024 products. The second returns only the keycaps. The keyboard isn’t an accessory, and the mouse’s title doesn’t contain KB-1024. For when to use each approach, see Search overview.

Legacy indexes

Indexes created before the Documents API keep working on the API they were created with: To move a legacy index to the Documents API, including converting it without reloading your data, see Move to the Documents API.