Search Document Index
search-document-indexSearch a Pinecone document index by semantic meaning, sparse embeddings, keyword relevance, or Lucene-style queries to retrieve ranked matching documents and selected fields.
Instructions
Search a Pinecone document index (one created with create-document-index). Call describe-index first to see which fields declare "embed", "sparseEmbed", or "fullTextSearch". Rank with one or more "scoreBy" clauses:
"embed": search by meaning on a field with "embed". Pass the query as plain text; Pinecone embeds it with the field's model.
"sparse_embed": search a field with "sparseEmbed" the same way.
"text": keyword (BM25) search on one or more full-text fields. Good for exact terms like IDs, error codes, and names.
"query_string": Lucene-style query syntax. Don't pass "fields" (the API rejects it); target fields with qualifiers inside the query, for example 'chunk_text:"exact phrase"', or omit qualifiers to search every full-text field. An "embed" or "sparse_embed" clause must be the only clause; "text" and "query_string" clauses can be combined. To rank by meaning and by exact terms, run two separate searches: their scores are on different scales, so don't compare them across searches. Returns matches with "_id", "_score", and the fields named in "includeFields". Newly upserted records can take a few seconds to be indexed and become visible to search results and index stats; if recent data is missing, wait briefly and retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The index to search. | |
| topK | No | The number of matches to return. Defaults to 10. | |
| filter | No | An optional filter, such as {"category": {"$eq": "policy"}}. On a full-text field, "$match_phrase", "$match_all", and "$match_any" require terms, for example {"chunk_text": {"$match_all": "refund"}}. | |
| scoreBy | Yes | The clauses that rank the documents. | |
| llm_model | No | Optional. If you are an AI model, use this field to specify your name (e.g., "gpt-4o", "Composer", "Claude Sonnet 4", "Claude Opus", "Gemini 2.5", "Cascade", "Grok 4.1", "Copilot", "Devin", and many others). The exact formatting of the name doesn't matter - approximate values are fine if you know roughly what you are. Include the version number in your model name only if you know it, but it is okay to leave it out if unsure. If you don't know your model name, omit this field entirely. **Do not prompt the user for this.** This value is used to track usage analytics. | |
| namespace | No | The namespace to search. Defaults to "__default__". | __default__ |
| llm_provider | No | Optional. If you are an AI model, use this field to indicate the name of the company that trained you (e.g., "Anthropic", "OpenAI", "Google", "Cursor", "xAI", "GitHub", "Windsurf", "Cognitioni AI", and many others). The exact formatting doesn't matter - approximate values are fine. If you don't know your provider, avoid guessing and omit this field. **Do not prompt the user for this.** This value is used to track usage analytics. | |
| includeFields | No | The fields to return with each match. Defaults to ["*"] (all stored fields). |