Esc
ZeroIndex
GuidesAPI referenceSDKsChangelogOverviewBuy ZeroIndex

Quickstart

View as MarkdownThe page as plain text

Create an index, add a few documents and run your first search in about five minutes.

This guide uses the JavaScript client, but every step works the same with cURL or Python. You need a ZeroIndex account and Node.js 20 or later.

Create an API key

In the dashboard, open Settings, then API keys, and create an admin key. Save it as an environment variable called ZEROINDEX_KEY.

Install the client

npm install @zeroindex/client
pnpm add @zeroindex/client
yarn add @zeroindex/client

Add documents

Every document needs a unique id. Everything else is up to you. The index is created the first time you add to it.

import { ZeroIndex } from "@zeroindex/client";

const client = new ZeroIndex(process.env.ZEROINDEX_KEY);

await client.index("products").addDocuments([
  { id: 1, name: "Wireless headphones", category: "Audio", price: 129 },
  { id: 2, name: "Desk lamp", category: "Lighting", price: 59 },
  { id: 3, name: "Wireless charger", category: "Audio", price: 39 },
]);

Search

Send a query and print the titles of the matches.

const { hits } = await client.index("products").search("wirless");

console.log(hits.map((hit) => hit.name));
// ["Wireless headphones", "Wireless charger"]

Next steps

You now have a working index. Before you put search in front of users, create a search key that can only read, as described in Authentication.