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. The key difference is that autocomplete performs prefix matches on fields rather than token matching. This allows you to take a user's input in real-time and compare it against a smaller representation of a full document field.

If your client will not send a request body on a GET, then use POST instead.

Autocomplete within an Engine

When you use autocomplete within an Engine, it will search for prefix matches over all text field types.

For example, if the bookstore Engine has text 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 /api/v1/engines/{engine_id}/suggest.json?q={query}
POST /api/v1/engines/{engine_id}/suggest.json
Example - Get autocomplete suggestions from the bookstore Engine for the prefix query "act"
curl -X GET 'https://search-api.swiftype.com/api/v1/engines/bookstore/suggest?q=act&auth_token=YOUR_API_KEY'

Autocomplete within a DocumentType

When you use autocomplete within a DocumentType, the endpoint will only search for prefix matches over the specified text field type.

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

GET /api/v1/engines/{engine_id}/document_types/{document_type_id}/documents/suggest.json?q={query}
POST /api/v1/engines/{engine_id}/document_types/{document_type_id}/documents/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/engines/bookstore/document_types/books/suggest?q=action&auth_token=YOUR_API_KEY'

Stuck? Looking for help? Contact Support!