Back

What is Pinecone? Searching Through Context

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?”

  • Semantic searchFind paragraphs or pictures by what they mean, even when the exact words differ
  • Retrieval for RAGPull the best chunks before an AI writes an answer, so the answer has something real to lean on
  • Similar-item lookupShow near neighbors: related articles, similar products, lookalike FAQs

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.

  1. TextYour docs or captions
  2. NumbersEmbedding vectors
  3. IndexStored in Pinecone
  4. 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 once
  • POST …/records/namespaces/{ns}/upsert — send NDJSON records
  • POST …/records/namespaces/{ns}/search — ask with query.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"]}
  1. Create the serverless index once (model + which field to embed)
  2. Upsert records when the corpus changes
  3. Search with query.inputs.text on each visitor question

Ongoing work indexupsertsearch

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:

  • Support and FAQ answersIndex help articles and past tickets. A visitor asks in their own words; you pull the closest passages and hand them to a person or to an AI that writes the reply
  • Search inside a document setPolicies, research PDFs, wiki pages. People search by idea (“parental leave after adoption”) instead of hoping they typed the official title
  • Product or content recommendationsStore embeddings for items a shopper already liked. Return near neighbors: similar products, related posts, lookalike courses
  • Media found by descriptionKeep image or video files on your servers. Put captions or transcripts in Pinecone. A query like “rusty bike against a wall” surfaces the right asset without exact filenames
  • RAG for an internal assistantChunk company docs into the index. Each chat turn retrieves a few chunks first, then the language model answers with that context in front of it

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.

  1. Config stays on the server (pinecone.php), never in the browser
  2. A CLI script creates the integrated index and upserts records
  3. A tiny PHP proxy accepts a short query and returns ranked hits
  4. 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.

  • Already on PostgresTry pgvector before adding another vendor
  • Tiny local experimentsA folder of vectors in memory can teach the idea
  • Want zero opsThen a managed index like Pinecone is the point

8 References

ResourceWhy it helps
What is a vector databaseOfficial Learn explainer
Semantic searchMeaning search in plain terms
Create an indexIntegrated embedding setup
Pinecone pricingStarter limits
HN: managed vs pgvectorCommunity tradeoff thread
Back