Preview data frame transforms APIedit

Warning

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

Previews a data frame transform.

Requestedit

POST _data_frame/transforms/_preview

Request Bodyedit

source
The source index or index pattern.
pivot
Defines the pivot function group by fields and the aggregation to reduce the data.

Authorizationedit

If the Elasticsearch 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 data frame transform. For more information, see Security privileges and Built-in roles.

Examplesedit

The following example obtains a preview of a data frame transform on the Kibana eCommerce sample data:

POST _data_frame/transforms/_preview
{
  "source": {
    "index": "kibana_sample_data_ecommerce"
  },
  "pivot": {
    "group_by": {
      "customer_id": {
        "terms": {
          "field": "customer_id"
        }
      }
    },
    "aggregations": {
      "max_price": {
        "max": {
          "field": "taxful_total_price"
        }
      }
    }
  }
}

The data that is returned for this example is as follows:

{
  "preview" : [
    {
      "max_price" : 171.0,
      "customer_id" : "10"
    },
    {
      "max_price" : 233.0,
      "customer_id" : "11"
    },
    {
      "max_price" : 200.0,
      "customer_id" : "12"
    }
    ...
  ]
}