Home
Analytics
Birt reports communicating with elasticsearch using REST
Srinivas Yarra
<p>Hi,</p>
<p> </p>
<p>Please guide me how to connect the Birt reports from Elasticsearch engine with help REST or JS API.</p>
<p>Data pulling from elasticsearch for generating Birt charts/reports.</p>
<p> </p>
Find more posts tagged with
Comments
xavierchavanet
<p><span>Srinivas,</span></p>
<p><span>Have you found a way to communicate with elasticseach ?</span></p>
<p> </p>
<p><span>Thank in advance for your help.</span></p>
<p><span>Regards</span></p>
JFreeman
<p>You could use a scripted data source/set to connect to the elasticsearch REST to populate the data set.</p>
<p> </p>
<p>Take a look at this example of using a scripted data source/set with a web service: <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/36913-birt-web-service-rest-json/?p=138062'>http://developer.actuate.com/community/forum/index.php?/topic/36913-birt-web-service-rest-json/?p=138062</a></p>
;
<p> </p>
<p>It's not exactly what you need but it is close and should serve as a base for moving forward.</p>
Clement Wong
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;">Here is a very simple example of BIRT connecting to ElasticSearch using a Scriped Data Set. You can take a look at it for reference. The three events were added:</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> <strong>Data Source > Open</strong></span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> Make a query request to ElasticSearch</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> Save the results in a JSON variable</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> <strong>Data Set > Open</strong></span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> Reset the row counter to zero</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> <strong>Data Set > Fetch</strong></span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> Create a row of data from ElasticSearch for each “hitâ€</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> Set the output column field values from the JSON result set</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;"> Stop when total hits are reached</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;">Place the helper JavaScript, “json.jsâ€, into the root of the project folder.</span></span></span></p>
<p> </p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;">The alternative is to write your own ODA. There is a customer I am aware of who did write one, but I'm not sure it's posted in the DevShare or in GitHub.</span></span></span></p>