Update metadata
Change a document's metadata without re-indexing its content. Useful for updating URLs, prices, or feature flags.
import { Etoile } from "@etoile-dev/client";
const etoile = new Etoile({
apiKey: process.env.ETOILE_API_KEY,
});
await etoile.patch({
id: "starry-night",
metadata: {
artist: "Vincent van Gogh",
year: 1889,
featured: true,
},
});const response = await fetch("https://etoile.dev/api/v1/documents", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.ETOILE_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
id: "starry-night",
metadata: {
artist: "Vincent van Gogh",
year: 1889,
featured: true,
},
}),
});curl -X PATCH "https://etoile.dev/api/v1/documents" \
-H "Authorization: Bearer $ETOILE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "starry-night",
"metadata": {
"artist": "Vincent van Gogh",
"year": 1889,
"featured": true
}
}'Related
- Update metadata (PATCH) — API reference
- Use metadata — attach metadata when indexing