search mobile facets autocomplete spellcheck crawler rankings weights synonyms analytics engage api customize documentation install setup technology content domains user history info home business cart chart contact email activate analyticsalt analytics autocomplete cart contact content crawling custom documentation domains email engage faceted history info install mobile person querybuilder search setup spellcheck synonyms weights engage_search_term engage_related_content engage_next_results engage_personalized_results engage_recent_results success add arrow-down arrow-left arrow-right arrow-up caret-down caret-left caret-right caret-up check close content conversions-small conversions details edit grid help small-info error live magento minus move photo pin plus preview refresh search settings small-home stat subtract text trash unpin wordpress x alert case_deflection advanced-permissions keyword-detection predictive-ai sso

Autocomplete

The autocomplete endpoint supports similar options to the Searching endpoint.

Autocomplete performs prefix matches on fields rather than token matching.

Prefix matching compares a user's input against a smaller document representation in real time.

Engine Type Supported?
Crawler-based Engine YES
API-based Engine YES

Read more about Crawler-based Engines and API-based Engines within the API Overview.

Autocomplete within an Engine

Search for prefix matches over all string field types.

For example, if the bookstore Engine has string fields for books, tea, toys and magazines, then autocomplete will look for prefixes across all of these fields. This can be useful to help visitors find the popular thing, but might be less useful if someone just wanted to look for a book.

GET https://search-api.swiftype.com/api/v1/public/engines/suggest.json
POST https://search-api.swiftype.com/api/v1/public/engines/suggest.json


Example - Get autocomplete suggestions for the prefix query "act"
curl -X GET 'https://search-api.swiftype.com/api/v1/public/engines/suggest.json' \
  -H 'Content-Type: application/json' \
  -d '{
        "engine_key": "YOUR_ENGINE_KEY",
        "q":"act"
      }'

Autocomplete within a DocumentType

Search for prefix matches over the specified string field type.

For example, the bookstore Engine has string fields for books, tea, toys and magazines and you only want to search for prefix matches over books.

GET https://search-api.swiftype.com/api/v1/public/engines/suggest.json
POST https://search-api.swiftype.com/api/v1/public/engines/suggest.json


Example - Get autocomplete suggestions from the books DocumentType for the prefix query "act"
curl -X GET 'https://search-api.swiftype.com/api/v1/public/engines/suggest.json' \
  -H 'Content-Type: application/json' \
  -d '{
        "engine_key": "YOUR_ENGINE_KEY",
        "q":"act",
        "document_types": ["books"]
      }'

Analytics, Autoselect

You can make an analytics autoselect request to record information on which documents were clicked or selected during autocomplete.

Read the Analytics API Reference for more information.


Stuck? Looking for help? Contact support or check out the Site Search community forum!