Overview
Version
| Report Server Version | JAR Package Version | Plugin Version | Elasticsearch Version |
|---|---|---|---|
11.0 | 2018-07-31 | V1.0 | V6.4.0 and later versions |
11.0 | 2021-01-26 | v1.5.12 | v7.11 to 8.x |
Application Scenario
Elasticsearch, abbreviated as ES, is a real-time distributed search and analysis engine based on Lucene, boasting as the mainstream enterprise-level search engine. It provides a distributed service that allows you to quickly store, query, and analyze ultra-large datasets in near real-time. It is commonly used as the foundational engine or technology for building complex query features and applications with powerful requirements.
With this plugin, you can create datasets more conveniently and quickly, and view data queries and common data aggregation results based on DSL in FineReport.
After powerful report display capabilities of FineReport are combined with Elasticsearch's data search advantages, enterprise system applications will be undoubtedly more competitive.
Function Description
This plugin offers FineReport dataset functions developed based on the Java High Level REST Client API provided by Elasticsearch, which is compatible with Elasticsearch of 6.4.0 and later versions.
The main functions of the plugin are as follows.
· You can create Elasticsearch data connections and maintain configuration parameters in the designer.
· You can create Elasticsearch datasets in either Server Dataset or Template Dataset in the designer.
· You can create separate datasets for queried data details and aggregated analysis results.
Plugin Introduction
Plugin Installation
You can obtain the Elasticsearch Dataset -Delight Edition plugin at https://community.finereport.com/plugin/?id=137.
For details about how to install the plugin in the designer, see Designer Plugin Management.
For details about how to install the plugin on the server, see Server Plugin Management.
Operation Method
After installing the plugin, establish a data connection and create a dataset.
Creating an ES Data Connection
In the FineReport designer, choose Server > Define Data Connection, click the plus sign in the pop-up window, and select Elasticsearch, as shown the following figure.

The following describes definable data items:
Custom data connection name (framed by read box 1): The name starts with Elasticsearch.
Database Address (framed by red box 2): Enter the URL or IP address of the Elasticsearch service, (for example, http://192.168.3.102 or https://192.168.3.102). Multiple addresses need to be separated by commas.
Port Number (framed by red box 3): Enter the port number (9200 by default) of the Elasticsearch service. Multiple port numbers need to be separated by commas. The port numbers here must be in the same order as those in the address.
Username and Password: Enter the username and password if authentication is required. If the default empty values are used, no authentication is performed.
You can click Connection Configuration for detailed maintenance.

You can select Use SSL (JKS/PKCS12/CRT Certificate Supported) and set Certificate Path and Certificate Key to support access by HTTPS.
After configuration, you can click the Test Connection button to check the connection status.
Finally, click the OK button to save and complete this step.
Creating an ES Dataset
Template Dataset
When creating a template dataset in a report, select Elasticsearch Dataset for the query window to pop up, as shown in the following figure.


The following describes each function item in the dataset query window:
· Data connection drop-down list (framed by red box 1): Select the defined ES data connection name.
· ES index search area (framed by red box 2): Query and list the indexes (similar to data tables) that match the input conditions in the ES database. All indexes are displayed by default. After you double-click an index, the index is automatically entered into the Index Range box.
· Index Range box (framed by red box 3): Enter the index to be queried. If multiple indexes are entered, separate them with commas.
· Type Range box: Enter the type to be queried. If multiple types are entered, separate them with commas. The Elasticsearch type is no longer recommended officially. Therefore, just leave this box empty by default.
· Operation Type (framed by red box 4): If you select Query, data details are displayed as the dataset. If you select Aggregation, aggregated data statistics are displayed as the dataset.
· Query Condition (framed by red box 5): Enter DSL statements. Both the query DSL and aggregation DSL are supported. The data row quantity set in the query condition takes precedence over that set for the dataset preview.
The Elasticsearch database returns only 10 rows of data by default. When you set Operation Type to Query, you need to specify size.
· Parameter/Value area (framed by red box 6): You can use parameters in the ${Parameter name} form in the query condition, and just maintain the values of these parameters in the specific area.
Server Dataset
The operation steps here are the same as that during configuration in the template dataset. You can reference parameters, for example, ${size}, in the query condition.

Example
The following figure shows the dataset preview effect.
Content Query Preview

Aggregation Statistics Preview

Report Preview

Notes
The Elasticsearch database returns only 10 rows of data by default. When you set Operation Type to Query, you need to specify size. Otherwise, only 10 rows of data are displayed during report preview.
If size is not added to the query condition in the dataset preview window and Max Number of Previewed Rows is set to a value greater than 10000 in the preview window, an error message will be displayed, prompting you to add the size parameter value or increase the max_result_window property of the index.
Occasionally, the error java.lang.reflect.UndeclaredThrowableException occurs in the cluster, caused by changes in the serialized values of classes due to the upgrade of FanRuan JAR packages. You can restart the cluster and clear the cache to resolve the problem