Overview
In Fess normal search, only a certain number of search results are displayed via paging functionality. To retrieve all search results in bulk, use the Scroll Search feature.
This feature is useful when you need to process all search results, such as bulk data export or backup, and large-scale data analysis.
Use Cases
Scroll search is suitable for purposes such as:
Exporting all search results
Retrieving large amounts of data for data analysis
Data retrieval in batch processing
Data synchronization to external systems
Data collection for report generation
Warning
Scroll search returns large amounts of data and consumes more server resources compared to normal search. Enable only when necessary.
Configuration
Enabling Scroll Search
By default, scroll search is disabled from security and performance perspectives. To enable it, change the following setting in app/WEB-INF/classes/fess_config.properties (or /etc/fess/fess_config.properties for RPM/DEB packages).
Note
After changing settings, you must restart Fess.
Scroll Context Lifetime
The scroll context lifetime for scroll search is fixed internally in Fess at 1m (1 minute). This value cannot be changed from fess_config.properties.
Note
There is a setting called index.scroll.search.timeout, but it is used for internal operations involving index updates or deletions (update by query / delete by query) and does not affect the timeout for this feature (search scrolling).
Response Field Configuration
You can customize the fields included in search result responses. By default, many fields are returned, but you can also specify additional fields.
When specifying multiple fields, list them separated by commas.
Note
The content field is not included in the default response. To retrieve full text, add it using the setting above.
Usage
Basic Usage
Access scroll search using the following URL:
Search results are returned in NDJSON (Newline Delimited JSON) format. Each line outputs one document in JSON format.
Example:
Request Parameters
The following parameters can be used with scroll search:
Note
Scroll search only supports the GET method. Accessing with any method other than GET returns 405 Method Not Allowed.
| Parameter Name | Description |
|---|---|
q | Search query (required) |
num | Number of items to retrieve per scroll (default: 10, max: 100) |
fields.label | Filtering by label |
Note
The maximum value of num is controlled by paging.search.page.max.size (default: 100). Values exceeding the maximum are automatically capped. The default value uses paging.search.page.size (default: 10). If a value of 0 or less is specified for num, an error (INVALID_REQUEST) is returned.
Specifying Search Queries
You can specify search queries just like normal searches.
Example: Keyword search
Example: Field-specific search
Example: Retrieve all (no search conditions)
Specifying Retrieval Count
You can change the number of items retrieved per scroll.
Note
Increasing the num parameter too much will increase memory usage. The default maximum is 100. If a larger value is needed, change the paging.search.page.max.size setting.
Filtering by Label
You can retrieve only documents belonging to a specific label.
About Access Control
Note
Scroll search applies role-based access control (RBAC) just like normal search. Only documents accessible based on the role information in the request are returned; documents for which the user does not have view permissions are not included in the results.
Warning
The scroll search endpoint does not require authentication by default (anyone can access it). However, the documents returned are filtered by the role-based access control described above. If you wish to restrict access to the endpoint itself, configure IP address restrictions or authentication via a reverse proxy or similar mechanism.
Response Format
NDJSON Format
Scroll search responses are returned in NDJSON (Newline Delimited JSON) format. The Content-Type is application/x-ndjson; charset=UTF-8. Each line represents one document wrapped in the {"data": {...}} format.
Example:
Note
Each document is stored under the data key. On the client side, parse each line and then refer to the value of the data key.
Error Behavior
If an error occurs on the server side after the stream has started being sent, the following error terminator line is output as the final line of the response.
Note
On the client side, you can determine whether the stream completed successfully or whether a server-side error occurred mid-stream by checking whether the final line contains the error key. Note that if writing the error terminator line itself fails, the terminator line will not be output and the stream will end mid-way; treat unexpected disconnections as errors as well.
Response Fields
Fields included by default:
score: Search score_id: Document ID (OpenSearch document ID)doc_id: Document ID (internal to Fess)boost: Boost valuecontent_length: Content lengthhost: Hostnamesite: Sitelast_modified: Last modified date/timetimestamp: Timestampmimetype: MIME typefiletype: File typefilename: Filenamecreated: Creation date/timetitle: Titledigest: Body excerpturl: Document URLthumbnail: Thumbnailclick_count: Click countfavorite_count: Favorite counthas_cache: Cache availabilitycontent_title: Display titlecontent_description: Display body excerpturl_link: Display link URLsite_path: Site path
Note
The fields actually output are limited to those permitted as API response fields. Fields with no value are not output.
Note
content (full text) is not included by default. It can be added via query.additional.scroll.response.fields.
Data Processing Examples
Python Processing Example
Saving to File
Example of saving search results to a file:
Converting to CSV
Example of converting to CSV using the jq command:
Data Analysis
Example of analyzing retrieved data:
Performance and Best Practices
Efficient Usage
Set an appropriate num parameter
Too small increases communication overhead
Too large increases memory usage
Default maximum: 100
Optimize search conditions
Specify search conditions to retrieve only necessary documents
Execute full retrieval only when truly necessary
Use off-peak hours
Retrieve large amounts of data during periods of low system load
Use in batch processing
Execute periodic data synchronization as batch jobs
Optimizing Memory Usage
When processing large amounts of data, use streaming processing to reduce memory usage.
Security Considerations
Access Restrictions
Since scroll search returns large amounts of data, configure appropriate access restrictions. The endpoint does not require authentication by default, so consider the following measures as needed.
IP Address Restriction
Allow access only from specific IP addresses
API Authentication
Use API tokens or Basic authentication via a reverse proxy or similar mechanism
Role-Based Access Control
Documents returned are filtered by Fess role-based access control
Rate Limiting
To prevent excessive access, it is recommended to configure rate limiting with a reverse proxy.
Troubleshooting
Cannot Use Scroll Search
Verify that
api.search.scrollis set totrue.Verify that Fess was restarted.
Check error logs.
Timeout Errors Occur
Reduce the
numparameter to distribute processing.Narrow search conditions to reduce the amount of retrieved data.
Out of Memory Errors
Reduce the
numparameter.Increase the Fess heap memory size.
Check the OpenSearch heap memory size.
Response is Empty
Verify that the search query is correct.
Verify that specified labels or filter conditions are correct.
Role-based access control means documents for which the user does not have view permissions are not included in the results. Verify the role settings on the request.
References
Search Features - Search features details
Search-Related Settings - Search-related settings