kibana/docs/developer/architecture/development/csv-integration.asciidoc
Tim Sullivan d0419554d7
[Reporting/Docs] Update Developer API docs (#179723)
## Summary

Part of documentation updates required for
https://github.com/elastic/kibana-team/issues/720

* Removes outdated info about Angular directives
* Remove outdated info about the original CSV export type
* Add explanation of what an Export Type is
* More detail about the job parameters for each export type
* Add tips to debug using POST URLs
2024-04-01 15:02:36 +00:00

44 lines
1.8 KiB
Text

[float]
=== CSV
[float]
==== Job parameters of CsvSearchSource
The export type to generate CSV reports and is available in Discover uses "search source" objects. This export type is called
`csv_searchsource` in the code. A configuration for a CSV report job is represented with an interface that includes the
`BaseParams` and the following fields. To create a request for a CSV report, these required job parameters are Rison encoded into
a query string variable of the report generation URL:
----
interface JobParamsCSV {
searchSource: SerializedSearchSourceFields; <1>
columns?: string[]; <2>
};
----
<1> An object of serialized data that internally represents a search object in Kibana. It will contain a reference to a DataView
saved object.
<2> An array of field names to include as columns in the CSV report.
[float]
==== Job parameters of CsvFromSavedObject
A newer export type to generate CSV reports is available, currently only by API. This export type is called `csv_v2` in the code.
----
interface JobParamsCsvFromSavedObject {
locatorParams: LocatorParams[]; <1>
};
----
<1> The `locatorParams` value is controlled by the Discover application and identifies a search loaded in Discover, including the
selection of DataView, columns and filters. Only a single value in the array is permitted in the `createJob` method.
[float]
==== Job payload
After the job parameters are received by the route handler for the report generation URL, an additional field is automatically
added to the fields from job parameters:
----
interface TaskPayloadCSV {
pagingStrategy: 'scan' | 'pit' <1>
}
----
<1> The `pagingStrategy` value is taken from the value of the `xpack.reporting.csv.scroll.strategy` setting in kibana.yml and used
to control how the `runTask` method pages through all of the data.