logo
small logo
  • Products
  • Buy
  • Support
  • About
  • Customer panel Support
    • en
    • de
    • JP
    • ZH
  • Home
  • /
  • Articles
  • /
  • Connecting to Elasticsearch
  • Building libgdiplus library from source

    October 2, 2020

    When using the FastReport.NET (Core), FastReport Open Source and FastReport Mono libraries on Linux operating

    read more
  • The era of WinForms is over, the era of FastReport.Core.Skia began

    September 6, 2022

    To create high-quality reports and correctly export them to different formats (PDF, Word, Excel, etc.),

    read more
  • How to import a report from StimulSoft into FastReport .NET

    July 6, 2022

    Import of StimulSoft reports is now available with the 2022.2.13 release. To use it,

    read more
  • How to use Online Designer in ASP .NET Core

    January 17, 2018

    One of the novelties by FastReport .NET 2018 was the adaptation of OnlineDesigner to the

    read more
  • How to use WebReport with ASP .NET Web Core application

    January 17, 2018

    Recently FastReport introduced a new library under the .NET - FastReport Core platform. This is

    read more

Connecting to Elasticsearch

November 10, 2021

Now FastReport .NET, Core, Mono, and OpenSource products allow connecting to Elasticsearch. Elasticsearch is a scalable utility program for full-text search and analytics, which allows storing, searching, and analyzing large volumes of data quickly and in real-time mode.

You may obtain data in JSON format from Elasticsearch. FastReport .NET has a connection to JSON and it is rather convenient to use data in this format. That is why this format will be used as a middleware between FastReport .NET and Elasticsearch.

Important notice! FastReport implements only connecting to Elasticsearch as a source of data, without the opportunity to search in the data stored in it.

To create a connection to Elasticsearch, click the Data tab in the Designer and select Add data source. In the window that appears click New connection. To connect, you will need endpoint Elasticsearch and indication of the titles for data access, for example, authorization data (there is a grid for that below). If the data access is granted, a list of tables will appear after clicking the Next button. For successful connection, put a tick on the left of the table title. Then the connection setting will be complete.

Connecting to Elasticsearch

After connecting the data source, you have to connect a band to it.

Report template with a connection to ElasticSearch

As a result, the report will use data from the created connection to Elasticsearch.

Ready report with the data from a connection to ElasticSearch

If you need to select data for connection, you may make a GET enquiry and use it as a JSON connection string. In the example below you may see a search for records containing the word Bruno in the name field and are located in the demo index (these are the names of the table in Elasticsearch). Also, if there are over 10 records, you will have to add the size parameter and indicate the necessary number of records in it.

Connecting to JSON

In the report you will also have to indicate the name of the data source in the DataSource band property; then the data will be extracted from the source to the report.

The report template using connection to JSON

Ready report with the data from a connection to JSON

An example of connecting to Elasticsearch from the code:

// create ESDataSourceConnectionStringBuilder instance
ESDataSourceConnectionStringBuilder builder = new ESDataSourceConnectionStringBuilder();
// set Elasticsearh end point
builder.EndPoint = "http://192.168.1.194:9200/";
// create ESDataSourceConnection instance
var connection = new ESDataSourceConnection();
//set connection string
connection.ConnectionString = builder.ConnectionString;
// init all table
connection.CreateAllTables();
// set name connection 
connection.Name = "NewConnection";
// create Report instance
var report = new Report();
// add connection to report
report.Dictionary.Connections.Add(connection);
// set connection show
connection.Enabled = true;
// choose table with name "demo" and connect it to the report
foreach(TableDataSource table in connection.Tables)
{
 if (table.Name == "demo")
 table.Enabled = true;
}

As a result of executing this code, we will be able to see a new “demo” table in the Designer in the list of available connections.

“Demo” table in the list of available connections

Now you know more about the opportunities for creating a connection to the Elasticsearch database. If you need to select data, you may use the connection to JSON.

about product buy
avatar
Vladislav Yarovoy
.NET Development
Fast Reports Team: Vladislav Yarovoy - NET Development at Fast Reports
.NET Mono FastReport Core JSON

Add comment
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Buy
  • Download
  • Documentation
  • Testimonials
  • How to uninstall
  • FAQ
  • Tutorial Video
  • Forum
  • Articles
  • Our News
  • Press about us
  • Resellers
  • Extended licensing
  • Contact us

© 1998-2023 by Fast Reports Inc.

  • Privacy Policy