Index your first document

Send a document to Etoile. It becomes searchable in seconds.


Prerequisites

  • An Etoile account (sign up)
  • A project with a secret key (from your dashboard)

The secret key is required for write operations (index, update, delete). Do not share it publicly.


Index a painting

We are indexing one document in the paintings collection and pointing to a URL in metadata for later use in your UI.

import { Etoile } from "@etoile-dev/client";

const etoile = new Etoile({
secretKey: process.env.ETOILE_SECRET_KEY,
});

// Index one document in the "paintings" collection.
await etoile.index({
id: "starry-night",
collection: "paintings",
title: "The Starry Night",
content: "The Starry Night is an oil-on-canvas painting by the Dutch...",
metadata: {
  artist: "Vincent van Gogh",
  year: "1889",
  url: "/paintings/starry-night",
},
});

Response

{
"id": "starry-night",
"message": "Document indexed successfully.",
"type": "text",
"usage": 847
}

Next