Skip to main content
Version: Unreleased

PDF Report Generation

This guide explains how to configure automated PDF reports using the Auto Trigger feature. PDF reports allow you to visualize Elasticsearch query results with charts and deliver them on a schedule.

Overview

PDF reports transform your data selections into visual charts rendered in document format. The system supports multiple chart types, automatic visualization inference, and flexible page configurations.


Quick Start

To create a PDF report, add toPdf as your format channel transformation type. The minimum configuration requires linking your data selections to chart entries.

Key principle: The variableName in your chart configuration must exactly match the variableName defined in your data selection.


Configuration Reference

Format Channel Structure

"formatChannel": [
{
"transformationType": "toPdf",
"parameters": {
"pageSize": "A4",
"orientation": "landscape",
"charts": [
{
"variableName": "YourDataVariable",
"chartTitle": "Your Chart Title"
}
]
}
}
]

Page Settings

ParameterOptionsDefaultDescription
pageSizeA4, Letter, LegalA4Physical page dimensions
orientationportrait, landscapelandscapePage orientation

Chart Configuration Options

Each chart entry supports the following properties:

PropertyRequiredDescription
variableNameYesMust match exactly the variableName from your data selection
chartTitleNoCustom title displayed above the chart. Defaults to a formatted version of the variable name (for example: CallDurationOverTime → Call Duration Over Time)
chartTypeNoExplicit visualization type. If omitted, the system automatically infers the best chart type
maxLengthNoMaximum items to display (applies to list and table types)

Automatic Chart Type Inference

When you omit the chartType property, the system analyzes your data and automatically selects the most appropriate visualization.

Chart Selection by Data Type

CategoryConditionChart
scalarvalue
time-seriesnested buckets + nested valuemultipleLine
time-seriesnested buckets onlystackedBar
time-seriesno nestingtimedateBar
categoricalnested + depth ≥ 2sunburst
categoricalnested + depth < 2list
categoricalno nesting + ≤ 8 itemsdonut
categoricalno nesting + > 8 itemslist
tabulartable
tuple≤ 8 itemsdonut
tuple> 8 itemslist
unknownfallbackvalue

Tip: For most use cases, automatic inference produces optimal results. Only specify chartType explicitly when you need a specific visualization that differs from the inferred default.


Chart Type Validation

When you explicitly set a chartType, the system validates that it is compatible with your data structure. If there is a mismatch, the report will fail with a descriptive error message.

Example Error

If you set "chartType": "stackedBar" on a simple date histogram without nested buckets:

Variable "CallsOverTime": Chart type "stackedBar" requires nested buckets in time-series data.
Recommended: "timedateBar".

Tip: If you encounter a validation error, either adjust your Elasticsearch query to match the chart requirements, or use the recommended chart type.


Minimal Schema Example

A simple PDF report with one data selection and one chart:

{
"$schema": "http://localhost:5555/api/asyncJobs/schema",
"name": "Daily Call Duration Report",
"description": "Single chart PDF report example",
"enabled": true,
"version": "1.0.0",
"cronDefinition": "0 6 * * *",
"type": "user",
"function": {
"functionReferenceList": [
{
"reportName": "Call Duration Report",
"description": "Hourly call duration over the last 24 hours",
"data": {
"selection": [
{
"dataSource": "es",
"variableName": "CallDurationOverTime",
"parameters": [
{
"index": "calls",
"ignore_unavailable": true
},
{
"size": 0,
"query": {
"bool": {
"must": [
{ "query_string": { "query": "attrs.type:call-end" } },
{ "range": { "@timestamp": { "gte": "now-24h", "lte": "now" } } }
]
}
},
"aggs": {
"agg": {
"date_histogram": {
"field": "@timestamp",
"fixed_interval": "1h"
}
}
}
}
]
}
],
"transformations": {
"transformationType": "js",
"codeFunctionReference": ""
},
"formatChannel": [
{
"transformationType": "toPdf",
"parameters": {
"pageSize": "A4",
"orientation": "landscape",
"charts": [
{
"variableName": "CallDurationOverTime",
"chartTitle": "Call Duration Over Time (Last 24 Hours)"
}
]
}
}
]
},
"transport": []
}
]
}
}

Variable Name Matching

The connection between data selections and charts relies on exact variableName matching.

Data Selection:

{
"dataSource": "es",
"variableName": "CallDurationOverTime",
"parameters": [ ... ]
}

Chart Configuration:

{
"variableName": "CallDurationOverTime",
"chartTitle": "Call Duration Over Time (Last 24 Hours)"
}

Important: Variable names are case-sensitive. CallDurationOverTime and calldurationovertime are treated as different variables.


Recommendations

Use CasePage SizeOrientationWhy
Dashboard ReportsA4 or LetterLandscapeMulti-chart layouts display better with wider horizontal space
Data TablesLegalPortraitExtra vertical space accommodates more rows without pagination
Single ChartsA4 or LetterPortraitFocused visualizations benefit from balanced dimensions

Common Patterns

Single Chart Report

"formatChannel": [
{
"transformationType": "toPdf",
"parameters": {
"pageSize": "A4",
"orientation": "portrait",
"charts": [
{
"variableName": "DailyCallVolume",
"chartTitle": "Daily Call Volume Summary"
}
]
}
}
]

Multi-Chart Dashboard

"formatChannel": [
{
"transformationType": "toPdf",
"parameters": {
"pageSize": "A4",
"orientation": "landscape",
"charts": [
{
"variableName": "CallVolume",
"chartTitle": "Call Volume Trend"
},
{
"variableName": "TopAgents",
"chartTitle": "Top Performing Agents",
"chartType": "list",
"maxLength": 10
},
{
"variableName": "CallDistribution",
"chartTitle": "Calls by Department",
"chartType": "donut"
}
]
}
}
]

Multiple Output Formats

You can generate PDF alongside other formats in the same report:

"formatChannel": [
{
"transformationType": "toPdf",
"parameters": {
"pageSize": "A4",
"orientation": "landscape",
"charts": [
{
"variableName": "SummaryData",
"chartTitle": "Executive Summary"
}
]
}
},
{
"transformationType": "toCsv",
"parameters": {}
},
{
"transformationType": "toJson",
"parameters": {}
}
]

Best Practices

  1. Use descriptive variable names — Names like CallDurationByHour are clearer than data1

  2. Let inference work for you — Only specify chartType when you need a specific visualization

  3. Match variable names exactly — Copy-paste to avoid typos between data selection and chart config

  4. Use landscape for dashboards — Multiple charts display better in landscape orientation

  5. Limit table rows — Use maxLength to keep table charts readable

  6. Test with Run Now — Validate your configuration immediately before scheduling


Troubleshooting

IssueCauseSolution
Chart shows "No Data"Variable name mismatchVerify exact spelling and case of variableName
Wrong chart type displayedInference selected different typeExplicitly set chartType
Chart type validation errorExplicit chartType incompatible with dataUse a compatible chart type or adjust your ES query
PDF too longTable has too many rowsAdd maxLength to limit rows