What is Pinecone? Searching Through Context
Pinecone stores meaning as numbers so you can search by context. Free-tier walkthrough plus a live PHP demo over this site’s writing and captioned images.
1 What Pinecone is for
Pinecone is a managed vector database. A vector database stores lists of numbers that stand for meaning (embeddings), then finds the closest lists when you ask a question. It is not a replacement for MySQL. It answers a different question: “what is nearest in meaning?”
Keep this in mind
If you only need exact filters and joins, stick with a normal database. Reach for Pinecone when meaning distance matters more than exact string match.
2 How meaning search works
An embedding model turns text into a long list of numbers. Similar ideas land close together in that number space. Pinecone stores those lists in an index (a named collection you query). At search time, your question becomes a list too, and Pinecone returns the nearest stored items.
- TextYour docs or captions
- NumbersEmbedding vectors
- IndexStored in Pinecone
- NeighborsClosest matches
Same model on write and read
The model that embeds your stored text must match the model that embeds the query. Mixed models scramble the map.
3 How you use it
You create a Pinecone account once and keep the API key on the server. After that, the work is index, upsert, and search. You do not create a new account on every run.
What a serverless index is
A serverless index is a named collection that Pinecone hosts for you. You do not pick servers or capacity. On the free Starter plan it lives in AWS us-east-1. When you create the index with integrated embedding, you choose the embedding model (this demo uses multilingual-e5-large) and which field on each record holds the text to turn into numbers (here chunk_text). Pinecone builds those numbers when you upsert and again when you search.
Upsert: load text and pictures
Upsert means send a record to add it, or replace it if that _id already exists. A text record needs a unique id, the chunk_text to embed, and metadata you want back later (title, source, url).
Picture files for this demo stay on the website under public/pinecone-search/corpus/. Pinecone does not store the image bytes. For each picture you upsert the caption as chunk_text (that is what gets embedded) and put the file path in metadata such as image, so a hit can show a thumbnail from your site.
{"_id":"glossary-embedding","chunk_text":"Embedding. A list of numbers that stand for meaning…","source":"glossary","title":"Embedding","url":"ai-glossary#embedding","image":""}
{"_id":"img-lemonade","chunk_text":"Iced lemonade. A tall glass of iced lemonade on a sunny table…","source":"image","title":"Iced lemonade","url":"pinecone-search/corpus/lemonade.webp","image":"pinecone-search/corpus/lemonade.webp"}
That body format is NDJSON: newline-delimited JSON. Each line is one JSON object. It is not one big JSON array. Pinecone’s upsert endpoint expects records that way.
POST /indexes/create-for-model— create the index oncePOST …/records/namespaces/{ns}/upsert— send NDJSON recordsPOST …/records/namespaces/{ns}/search— ask withquery.inputs.text
Search with inputs.text
The search JSON has a query object. Inside it, inputs holds the question fields. For integrated embedding, you set inputs.text to the plain-language question. That string is what Pinecone embeds and compares to the stored vectors. You also set top_k for how many neighbors to return.
{"query":{"inputs":{"text":"cold drink on a sunny table"},"top_k":5},"fields":["title","snippet","source","image"]}
- Create the serverless index once (model + which field to embed)
- Upsert records when the corpus changes
- Search with
query.inputs.texton each visitor question
Ongoing work index→upsert→search
4 Real cases where Pinecone fits
Pinecone shows up when you need nearest-by-meaning lookup at a scale or pace that is awkward to run yourself. A few concrete jobs:
What they share
Something large enough that keyword search misses good hits, and a need to rank by meaning under load. The demo below is the same idea on a tiny corpus.
5 Practice case: search this site’s context
The box below searches glossary terms, knowledge pills, article blurbs, and a few pictures. The pictures are found by their captions. Pinecone stores the caption text; the image files stay on this site. It is only the practice case.
- Try “turning words into numbers for similarity” for a text hit about embeddings
- Try “cold drink on a sunny table” to pull the lemonade picture by caption
- Try “rusty bike against a wall” for the bicycle image
6 The process I used
Build the example first, then write. Create the index, upsert the corpus, prove one meaning query and one image-by-caption query, then explain those steps in plain language.
- Config stays on the server (
pinecone.php), never in the browser - A CLI script creates the integrated index and upserts records
- A tiny PHP proxy accepts a short query and returns ranked hits
- The article embeds the search widget on this page
7 When not to use it
On Hacker News, the recurring stance is blunt: if your set is small and you already run Postgres, pgvector is often enough. Pinecone earns its keep when you want managed indexing, filtering, and scaling without babysitting the search stack yourself.
8 References
| Resource | Why it helps |
|---|---|
| What is a vector database | Official Learn explainer |
| Semantic search | Meaning search in plain terms |
| Create an index | Integrated embedding setup |
| Pinecone pricing | Starter limits |
| HN: managed vs pgvector | Community tradeoff thread |