Fetching Search Results
Request
| HTTP Method | GET |
| Endpoint | /api/v1/documents |
By sending a request to Fess like http://<Server Name>/api/v1/documents?q=search_term, you can receive Fess search results in JSON format. To use the search API, you need to enable JSON responses in the Administration screen under System > General Settings.
Request Parameters
You can perform more advanced searches by specifying request parameters such as http://<Server Name>/api/v1/documents?q=search_term&num=50&fields.label=fess. The available request parameters are as follows:
| q | Search term. Pass it after URL encoding. |
| start | Starting position of the result count. Starts from 0. |
| num | Number of items to display. Default is 20 items. Can display up to 100 items. |
| sort | Sort order. Used to sort search results. |
| fields.label | Label value. Used to specify a label. |
| facet.field | Facet field specification. (Example) facet.field=label |
| facet.query | Facet query specification. (Example) facet.query=timestamp:[now/d-1d TO *] |
| facet.size | Specification of the maximum number of facets to retrieve. Valid when facet.field is specified. |
| facet.minDocCount | Retrieve facets with a count equal to or greater than this value. Valid when facet.field is specified. |
| geo.location.point | Latitude and longitude specification. (Example) geo.location.point=35.0,139.0 |
| geo.location.distance | Distance from the center point specification. (Example) geo.location.distance=10km |
| lang | Search language specification. (Example) lang=en |
| preference | String to specify the shard during search. (Example) preference=abc |
| callback | Callback name when using JSONP. Not necessary to specify if not using JSONP. |
Table: Request Parameters
Response
Each element is as follows:
Searching All Documents
To search all target documents, send the following request: http://<Server Name>/api/v1/documents/all?q=search_term
To use this feature, you need to set api.search.scroll to true in fess_config.properties.
Request Parameters
The available request parameters are as follows:
| q | Search term. Pass it after URL encoding. |
| num | Number of items to display. Default is 20 items. Can display up to 100 items. |
| sort | Sort order. Used to sort search results. |
Table: Request Parameters
Error Response
When the search API fails, the following error response is returned:
| Status Code | Description |
| 400 Bad Request | When request parameters are invalid |
| 500 Internal Server Error | When an internal server error occurs |
Error response example: