Index text
The simplest way to get started. Pass a string as content and it becomes searchable.
import { Etoile } from "@etoile-dev/client";
const etoile = new Etoile({
apiKey: process.env.ETOILE_API_KEY,
});
await etoile.index({
id: "starry-night",
collection: "paintings",
title: "The Starry Night",
content: "A swirling night sky over a village...",
});const response = await fetch("https://etoile.dev/api/v1/index", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ETOILE_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
id: "starry-night",
collection: "paintings",
title: "The Starry Night",
content: "A swirling night sky over a village...",
}),
});curl -X POST "https://etoile.dev/api/v1/index" \
-H "Authorization: Bearer $ETOILE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "starry-night",
"collection": "paintings",
"title": "The Starry Night",
"content": "A swirling night sky over a village..."
}'Related
- Index document (POST) — API reference
- Node SDK — Index
- Use metadata — attach extra fields