Indexes
An index holds one kind of document, like products or articles, along with the settings that decide how it is searched.
An index is a collection of documents that you search together. Most apps have one index per kind of thing people look for: products, articles, customers. Each index has its own documents, its own settings and its own search endpoint.
Creating an index
You do not have to create an index before using it. The first time you add documents to a name that does not exist, ZeroIndex creates the index for you with the default settings. Create one explicitly when you want to choose the primary key or apply settings before any documents arrive.
curl https://api.zeroindex.test/v1/indexes \
-H "Authorization: Bearer $ZEROINDEX_KEY" \
-d '{ "uid": "products", "primaryKey": "id" }'await client.createIndex("products", { primaryKey: "id" });client.create_index("products", primary_key="id")The name of the index. Use lowercase letters, numbers, hyphens and underscores, up to 64 characters.
The field that uniquely identifies each document. It cannot be changed once the index has documents.
Settings
Settings control what is searchable, what can be filtered and how results are ranked. They apply to the whole index, and changing them rebuilds it in the background.
await client.index("products").updateSettings({
searchableAttributes: ["name", "brand", "description"],
filterableAttributes: ["category", "price", "in_stock"],
sortableAttributes: ["price", "created_at"],
});The fields that queries match against, most important first. Defaults to every field.
The fields you can use in filters and facets. Empty by default.
The fields you can sort results by. Empty by default.
Limits
| Free | Pro | |
|---|---|---|
| Indexes | 10 | Unlimited |
| Documents per index | 100,000 | 50 million |
| Size of one document | 100 KB | 1 MB |