Index users
Index user profiles to make them searchable by name, bio, or role.
import { Etoile } from "@etoile-dev/client";
const etoile = new Etoile({
apiKey: process.env.ETOILE_API_KEY,
});
await etoile.index({
id: "user-42",
collection: "users",
title: "Alice Martin",
content: "Product designer based in Paris...",
metadata: {
role: "designer",
url: "/team/alice-martin",
},
});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: "user-42",
collection: "users",
title: "Alice Martin",
content: "Product designer based in Paris...",
metadata: {
role: "designer",
url: "/team/alice-martin",
},
}),
});curl -X POST "https://etoile.dev/api/v1/index" \
-H "Authorization: Bearer $ETOILE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "user-42",
"collection": "users",
"title": "Alice Martin",
"content": "Product designer based in Paris...",
"metadata": {
"role": "designer",
"url": "/team/alice-martin"
}
}'Related
- Use metadata — attach extra fields
- Filter by collection — search only
"users" - Node SDK — Index