Fetching the Suggest Words List
Request
| HTTP Method | GET |
| Endpoint | /api/v2/suggest-words |
By sending a request to Fess such as http://<Server Name>/api/v2/suggest-words?q=fes, you can receive a list of suggest words for the given prefix in JSON format.
Suggest words come from three sources:
Documents — Generated from crawled documents. To obtain them, enable “Suggest from Documents” in the Administration screen under System > General.
Search terms (search log) — Generated from users’ search logs. To obtain them, enable “Suggest from Search Terms” in the Administration screen under System > General.
User dictionary — Suggest words registered by administrators. These are always returned regardless of the settings above.
Even when “Suggest from Documents” and “Suggest from Search Terms” are disabled, the API does not return an error; the corresponding suggest words are simply omitted from the results. Suggest words are also automatically filtered based on the roles of the requesting user.
For the common response envelope and error model, see API Overview.
Request Parameters
The available request parameters are as follows:
Note
In v2, field names are specified with the fn parameter (not fields as in v1). Instead of listing values as a comma-separated string, fn is repeated to pass multiple values.
Response
On success, the following response is returned in the common envelope format.
Each element of response is as follows:
Note
types contains tag values, not the kind of the suggest word (such as document or query). This array corresponds to the labels field of suggest items in v1. The label request parameter filters against these types values.
Usage Examples
Request example using curl:
Error Response
When the Suggest API fails, a common error envelope is returned. For details on the error model, see API Overview.