Index document

Add a document to your index.


Usage

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...",
metadata: {
  artist: "Vincent van Gogh",
  year: 1889,
},
});

This method requires your secret key. Never expose it in client-side code.


Parameters

ParameterTypeDescription
idrequiredstringUnique identifier.
collectionrequiredstringCollection name.
titlerequiredstringDocument title.
contentrequiredstringText, URL, or image URL.
metadataobjectOptional extra data.

Related