Firetool

Home / Docs / Pipelines and vector search

Docs

Firestore pipelines and vector search

From 4.5.4, build a pipeline query step by step in the Pipeline tab, fill a field with vectors made from your documents' text, and find the documents nearest to a vector. Pipelines need a Firestore Enterprise edition database; making embeddings needs Firetool Pro (or the trial).

Open the Pipeline tab

  1. Open a collection from the sidebar.
  2. Choose Actions ▾ → Pipeline…, or press Ctrl+K and type Pipeline.
  3. The Pipeline tab opens for that collection. Its first step, From, starts from the Collection, or from the Collection group (every collection with this ID).

Pipelines run on Firestore Enterprise edition databases. On a Standard edition database, Run says so in plain words; the query bar and JS Query work there as usual. Pipelines only read: nothing in the Pipeline tab changes data.

Add steps

Choose + Add step ▾ to add a step at the end. Each step works on what the step before it gives:

StepWhat it does
FilterKeeps documents that match. Add several conditions and choose Every condition matches or Any condition matches. Besides the usual comparisons there are lists (in, not in, array contains any or all), exists, is missing, starts with and contains text.
SortOrders by one or more fields, smallest or largest first.
LimitAt most this many results.
SkipLeaves out the first ones.
Keep fields / Remove fieldsOnly these fields, or every field but these.
TotalsCount, sum, average, minimum, maximum and count different, optionally grouped by fields.
Distinct valuesEach different value (or set of values) once.
Random sampleA random few documents.
Find nearestVector search: the documents whose vector field is closest to the vector you give, by cosine, Euclidean or dot product, with the distance in a field you name.

↑ and ↓ move a step, ✕ removes it. Field boxes suggest the fields Firetool has seen in the collection. The steps are kept for each collection on this computer, so they're there the next time you open its Pipeline tab.

Run a pipeline

  1. Choose Run.
  2. The results show as a table with how many there are and how long it took. Click a result's document ID to open it in the editor beside its collection.

A pipeline without a Limit (or a step that gives few results, such as Totals or Find nearest) would return every matching document, and each one is a document read. Firetool asks first, and adds a Limit of 100 at the end if you agree; change the number there if you need more.

Copy as code or open in JS Query

Copy as code copies the same pipeline as a JS Query script, and Open in JS Query opens it in a new JS Query tab, where you read it and choose Run. JS Query needs Pro. See pipelines in JS Query for writing them by hand.

Make embeddings

Vector search needs a vector in each document. Make embeddings… sends each document's text to your AI service and saves the vector it gives back in a field you name.

  1. Choose your AI service in Settings → AI: OpenAI or a compatible service, Google Gemini, Vertex AI, or Ollama on this computer, where nothing leaves the computer. Anthropic doesn't make embeddings, and Firetool says so.
  2. Open the collection, run the query for the documents you want, and choose Actions ▾ → Make embeddings… (or No vectors yet? Make embeddings… in a Find nearest step).
  3. Fill in Text from (one text field, or several separated by commas, sent as "name: value" lines), Save the vectors in, the Embedding model and, if you like, the Size.
  4. Choose every document matching the query, or the selected rows. Leave Skip documents that already have a vector in this field ticked to fill only the ones still missing.
  5. For a service outside this computer, tick I agree to send the text of these fields to it. No text is sent before you do.
  6. Choose Preview: Firetool sends three documents and shows the text sent, the start of each vector and the vector size.
  7. Choose Make embeddings.

Firetool goes through the documents a page at a time and skips those with no text (and, if ticked, those that already have a vector). It writes only the vector field, and only while the document is as it was read: a document someone changed meanwhile is skipped. The job runs in Tasks, where you can pause, resume or cancel it; after a stop, Resume carries on with the documents still missing a vector. Undo this operation takes the vectors out again.

Making embeddings needs Pro and follows the project's export rules, since text leaves Firestore. Your AI service may charge for it. The audit log records the service, the model and the counts, never the text.

Find the nearest documents

With vectors in place, add a Find nearest step in the Pipeline tab: the vector field, the measure, how many nearest, and the vector to compare with. In JS Query, a query's findNearest() does the same:

return db.collection("products")
  .findNearest({ vectorField: "embedding", queryVector: [0.12, -0.4, 0.33], limit: 10, distanceMeasure: "COSINE", distanceResultField: "distance" })
  .get();

A findNearest() query needs a vector index on the vector field. Create it in Tools → Indexes…: under New index, give the field the kind Vector with its size (the vector size the preview showed), as the last field, then Create index. Firestore takes a few minutes to build it. See Indexes.

Questions

Can a pipeline change my data?

No. The Pipeline tab only builds pipelines that read, and Firetool refuses any pipeline stage that would change data before anything is sent.

Why does my pipeline say it needs the Enterprise edition?

Firestore runs pipeline queries only on Enterprise edition databases. On a Standard edition database, use the query bar or JS Query instead.

Does making embeddings send my data anywhere?

Only the text of the fields you choose, only to the AI service chosen in Settings → AI, and only after you agree. With Ollama on this computer, nothing leaves the computer.