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 astitle 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 inscore_by, and an optional filter narrows the candidates first. You can run these types of search:
- Full-text search ranks by keyword relevance (BM25) with a
textorquery_stringclause. - Semantic search with integrated embedding ranks by meaning with an
embedclause, and Pinecone embeds your query. - Semantic search with your own vectors ranks by meaning with a
dense_vectorclause. - Sparse-vector search ranks by term weights with a
sparse_embedorsparse_vectorclause. - Semantic search filtered by text ranks by meaning but keeps only documents whose full-text fields contain exact terms or phrases, using
$match_all,$match_any, or$match_phrasein thefilter. - Hybrid search runs a full-text search and a semantic search and merges the results with reciprocal rank fusion.
{"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
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.