Make your first search
Find what you indexed in seconds.
Prerequisites
- A document indexed (see Index your first document)
- A public key from your dashboard
Use your public key for search. It is safe to use in the browser.
Search for a painting
We are searching the paintings collection for a short query. Try your own
words and see what comes back.
import { Etoile } from "@etoile-dev/client";
const etoile = new Etoile({
publicKey: process.env.ETOILE_PUBLIC_KEY,
});
const { results } = await etoile.search({
query: "night sky painting",
collections: ["paintings"],
limit: 5,
});const response = await fetch("https://etoile.dev/api/v1/search", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ETOILE_PUBLIC_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: "night sky painting",
collections: ["paintings"],
limit: 5,
}),
});
const { results } = await response.json();curl -X POST "https://etoile.dev/api/v1/search" \
-H "Authorization: Bearer $ETOILE_PUBLIC_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "night sky painting",
"collections": ["paintings"],
"limit": 5
}'Response
{
"query": "night sky painting",
"results": [
{
"external_id": "starry-night",
"title": "The Starry Night",
"collection": "paintings",
"metadata": {
"artist": "Vincent van Gogh",
"year": "1889",
"url": "/paintings/starry-night"
},
"score": 0.94
}
]
}Next
- Search documents (POST) — full API reference
- React SDK Setup — drop-in and primitives
- React SDK Styling — theme or custom UI
- Node SDK — search from your backend