Search Suggestions
Search suggestions
POST /indexes/{index_name}/recommendations/queries
Purpose
Help shoppers find relevant products faster by suggesting query terms as they type. Reduces zero-results and accelerates navigation to high-intent pages.
When to use
- Search bar suggestions on desktop and mobile
- Inline suggestions within site-wide navigation
Example uses
- Search as you type, show popular queries after typing in 2-3 characters
Example (cURL)
curl -X POST "https://api.marqo.ai/indexes/product-catalog/recommendations/queries" \
-H "Authorization: Bearer $MARQO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "iph",
"limit": 5
}'
Parameters
Name | Type | Required | Description | Example |
---|---|---|---|---|
q | string | yes | Partial query text typed by the user. | "iph" |
limit | integer | no | Max number of suggestions. Default 10. | 5 |
userId | string | no | Optional user identifier for personalization. | "abc123" |
sessionId | string | no | Optional session identifier. | "xyz789" |
If q
is not provided (or an empty string), top limit
queries will be returned.
Response (example)
{
"suggestions": [
{"suggestion": "iphone 15 case"},
{"suggestion": "iphone charger"},
{"suggestion": "iphone screen protector"},
{"suggestion": "iphone 14 pro"},
{"suggestion": "iphone accessories"}
]
}