My Autosuggest does not return any results
There are a few reasons why Autosuggest may not be working correctly. To troubleshoot, it’s helpful to understand a bit about how the Autosuggest feature works.
In order to add the JavaScript to your site that’s necessary for Autosuggest to function, ElasticPress first needs to be able to “find” your search bar on the page. If you’re using a stock WordPress theme like Twenty Twenty, or one built to follow WordPress markup standards, you shouldn’t need to do anything special to ensure that ElasticPress can find your search bar. If you have a custom theme that doesn’t include the typical classes or markup found on a WordPress search bar, you may have to specify the CSS selector in the ElasticPress Features menu in order to get Autosuggest working.
If you find Autosuggest isn’t working, follow these steps to troubleshoot:
- Confirm the Autosuggest Feature is enabled. To do this, go to the ElasticPress -> Features menu and click on the Autosuggest feature. Ensure the Enabled toggle is on. If it’s disabled, click to enable Autosuggest. NB: enabling Autosuggest will require reindexing, as Autosuggest adds a new field to your search to facilitate partial string matching.
- If Autosuggest is enabled but you’re still not seeing results, the next step is to use Chrome’s (or a similar browser’s) Developer Tools. You’ll want to look specifically at the Console tab to determine if there are any JavaScript errors. If you see any errors, you can fix them in code, or simply disable plugins that appear related to the errors to see if the errors disappear. Once you’ve eliminated any JavaScript errors, re-test Autosuggest.
- If you don’t see any errors but you’re not seeing Autosuggest results, the next step is to check the Network tab of Developer Tools. If you’re using ElasticPress.io, you should see a series of HTTP calls to URLs ending in /autosuggest, with one call appearing for every character typed or removed in the Autosuggest search. NB: you’ll need to type at least 3 characters for Autosuggest to start providing suggestions and issuing network requests.
- If you don’t see any requests in the Network tab, you might have an issue with your CSS selector. To resolve this, find the search input on which you want to enable Autosuggest, and add its selector into the Additional Selectors field of the Autosuggest feature box.
- If the network requests are being made and failing with a 403 error, you can try resolving this by re-saving the Weighting configuration by going to ElasticPress -> Search Fields & Weighting in your WordPress Dashboard and hitting the Save button. If this fails to resolve the issue, please file a ticket with our support team.