The Autosuggest feature displays suggested search results as users type in a WordPress search field. Suggestions appear in real time and link directly to matching pages, allowing users to navigate without visiting the full search results page.
Autocomplete is a feature that completes user query terms based on the closest term in the indexed documents (pages, posts and other custom indexables). This is done while the user is typing the query. This in turn reduces user typos and enhances the user experience specially for individuals that type words slowly.
Check out our guide to customize autosuggest‘s look and functionality.
How It Works
When a user begins typing, Autosuggest queries your site’s public content and returns a list of matching titles and possible completions. Selecting a suggestion takes the user directly to that page.
Note: The typed first character is always ignored and suggestion and completion are triggered on the next typed characters.
The feature is compatible by default with:
Any HTML input element with
type="search"
Any HTML element with the
search-field
class
Additional selectors can be added in the settings of the WP admin dashboard. Enter the selector in the provided field and click Save changes.
Checkout our guide on troubleshooting autosuggest.
Google Analytics Integration
Autosuggest supports Google Analytics Event Tracking for monitoring suggestion link clicks.
To enable:
Check Trigger Google Analytics events in the Autosuggest tab.
Ensure the Google Analytics global site tag is installed on your site.
For more details on event reporting, refer to the Google Analytics documentation.
Performance and Security Architecture of Autosuggest
ElasticProbe.com uses a custom API layer to power the feature. This architecture:
Enables direct querying of the Elasticsearch index for faster responses.
Avoids loading WordPress for each request, reducing processing overhead with AJAX.
Eliminates the need for a custom PHP proxy, removing an extra network hop and making it even faster.
Why a Custom API Layer?
Performance: Direct queries to Elasticsearch deliver faster results than standard AJAX-based methods.
Security: Direct Elasticsearch access can unintentionally expose restricted content (e.g., draft posts, WooCommerce orders) if not protected.
Control: The ElasticProbe.com service ensures only public content is returned while keeping Elasticsearch credentials secure.
Security Considerations
Queries between WP and Elasticsearch are authenticated, similar to MySQL credentials stored in
wp-config.php
.Additional safeguards (e.g., IP restrictions) are recommended for self-hosted Elasticsearch instances.
ElasticProbe.com’s implementation prevents exposure of protected content while maintaining optimal speed.
Summary
ElasticProbe’s Autosuggest provides fast, relevant, and secure search suggestions without complex configuration. It integrates seamlessly with supported search fields, supports Google Analytics tracking, and uses an optimized API layer to maximize both performance and security.