2019-03-20 13:19:41 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="basic"]
|
|
|
|
[[preview-data-frame-transform]]
|
|
|
|
=== Preview {dataframe-transforms} API
|
2019-04-30 13:46:13 -04:00
|
|
|
|
|
|
|
[subs="attributes"]
|
2019-03-20 13:19:41 -04:00
|
|
|
++++
|
|
|
|
<titleabbrev>Preview {dataframe-transforms}</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
2019-06-12 13:13:04 -04:00
|
|
|
beta[]
|
|
|
|
|
2019-03-20 13:19:41 -04:00
|
|
|
Previews a {dataframe-transform}.
|
|
|
|
|
|
|
|
|
|
|
|
==== Request
|
|
|
|
|
|
|
|
`POST _data_frame/transforms/_preview`
|
|
|
|
|
|
|
|
//==== Description
|
|
|
|
//==== Path Parameters
|
|
|
|
|
|
|
|
==== Request Body
|
|
|
|
|
|
|
|
`source`:: The source index or index pattern.
|
|
|
|
|
|
|
|
`pivot`:: Defines the pivot function `group by` fields and the aggregation to
|
|
|
|
reduce the data.
|
|
|
|
|
2019-06-12 13:13:04 -04:00
|
|
|
==== Authorization
|
|
|
|
|
|
|
|
If the {es} {security-features} are enabled, you must have
|
|
|
|
`manage_data_frame_transforms` cluster privileges to use this API. The built-in
|
|
|
|
`data_frame_transforms_admin` role has these privileges. You must also have
|
|
|
|
`read` and `view_index_metadata` privileges on the source index for the
|
|
|
|
{dataframe-transform}. For more information, see
|
|
|
|
{stack-ov}/security-privileges.html[Security privileges] and
|
|
|
|
{stack-ov}/built-in-roles.html[Built-in roles].
|
2019-03-20 13:19:41 -04:00
|
|
|
|
|
|
|
==== Examples
|
|
|
|
|
|
|
|
The following example obtains a preview of a {dataframe-transform} on the {kib}
|
|
|
|
eCommerce sample data:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
POST _data_frame/transforms/_preview
|
|
|
|
{
|
2019-05-03 11:30:41 -04:00
|
|
|
"source": {
|
|
|
|
"index": "kibana_sample_data_ecommerce"
|
|
|
|
},
|
2019-03-20 13:19:41 -04:00
|
|
|
"pivot": {
|
|
|
|
"group_by": {
|
|
|
|
"customer_id": {
|
|
|
|
"terms": {
|
|
|
|
"field": "customer_id"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"aggregations": {
|
|
|
|
"max_price": {
|
|
|
|
"max": {
|
|
|
|
"field": "taxful_total_price"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:set up sample data]
|
|
|
|
|
|
|
|
The data that is returned for this example is as follows:
|
|
|
|
[source,js]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"preview" : [
|
|
|
|
{
|
|
|
|
"max_price" : 171.0,
|
|
|
|
"customer_id" : "10"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"max_price" : 233.0,
|
|
|
|
"customer_id" : "11"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"max_price" : 200.0,
|
|
|
|
"customer_id" : "12"
|
|
|
|
}
|
|
|
|
...
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|
|
|
|
// NOTCONSOLE
|