Skip to content

Search Suggestions

Search suggestions

POST /indexes/{index_name}/recommend

Purpose

Help shoppers find relevant products faster by suggesting query terms and products 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 sitewide navigation

Example uses

  • Show popular queries and top products after 1–2 characters
  • Prefer in-stock, high-converting or high-margin items via filters

Example (cURL)

curl -X POST "https://api.marqo.ai/indexes/product-catalog/recommend" \
  -H "Authorization: Bearer $MARQO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "search_suggestions",
    "q": "iph",
    "limit": 5
  }'

Parameters

Name Type Required Description Example
method string yes Recommendation method identifier. "search_suggestions"
q string yes Partial query text typed by the user. "iph"
limit integer no Max number of suggestions. Default 10. 5
user_id string no Optional user identifier for personalization. "abc123"
session_id string no Optional session identifier. "xyz789"

Response shape (example)

{
  "request": { "q": "iph", "limit": 5 },
  "response": {
    "suggestions": [
      "iphone 15 case",
      "iphone charger",
      "iphone screen protector",
      "iphone 14 pro",
      "iphone accessories"
    ]
  }
}