Filter by collection
Search only one collection. Collections are like categories for your documents — "paintings", "artists", "users", etc.
import { Etoile } from "@etoile-dev/client";
const etoile = new Etoile({
apiKey: process.env.ETOILE_PUBLIC_KEY,
});
// Only search the "artists" collection
const { results } = await etoile.search({
query: "post-impressionist painter",
collections: ["artists"],
});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: "post-impressionist painter",
collections: ["artists"],
}),
});
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": "post-impressionist painter",
"collections": ["artists"]
}'Related
- Search across collections — query multiple at once
- Search (POST) — API reference