Path parameters
- transform_id
string Required Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters.
Query parameters
- defer_validation
boolean When the transform is created, a series of validations occur to ensure its success. For example, there is a check for the existence of the source indices and a check that the destination index is not part of the source index pattern. You can use this parameter to skip the checks, for example when the source index does not exist until after the transform is created. The validations are always run when you start the transform, however, with the exception of privilege checks.
- timeout
string Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
Values are
-1
or0
.
BodyRequired
- dest
object Required - description
string Free text description of the transform.
- frequency
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. - latest
object - _meta
object - pivot
object - retention_policy
object - settings
object The source of the data for the transform.
- source
object Required - sync
object
PUT _transform/ecommerce_transform1
{
"source": {
"index": "kibana_sample_data_ecommerce",
"query": {
"term": {
"geoip.continent_name": {
"value": "Asia"
}
}
}
},
"pivot": {
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id",
"missing_bucket": true
}
}
},
"aggregations": {
"max_price": {
"max": {
"field": "taxful_total_price"
}
}
}
},
"description": "Maximum priced ecommerce data by customer_id in Asia",
"dest": {
"index": "kibana_sample_data_ecommerce_transform1",
"pipeline": "add_timestamp_pipeline"
},
"frequency": "5m",
"sync": {
"time": {
"field": "order_date",
"delay": "60s"
}
},
"retention_policy": {
"time": {
"field": "order_date",
"max_age": "30d"
}
}
}
resp = client.transform.put_transform(
transform_id="ecommerce_transform1",
source={
"index": "kibana_sample_data_ecommerce",
"query": {
"term": {
"geoip.continent_name": {
"value": "Asia"
}
}
}
},
pivot={
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id",
"missing_bucket": True
}
}
},
"aggregations": {
"max_price": {
"max": {
"field": "taxful_total_price"
}
}
}
},
description="Maximum priced ecommerce data by customer_id in Asia",
dest={
"index": "kibana_sample_data_ecommerce_transform1",
"pipeline": "add_timestamp_pipeline"
},
frequency="5m",
sync={
"time": {
"field": "order_date",
"delay": "60s"
}
},
retention_policy={
"time": {
"field": "order_date",
"max_age": "30d"
}
},
)
const response = await client.transform.putTransform({
transform_id: "ecommerce_transform1",
source: {
index: "kibana_sample_data_ecommerce",
query: {
term: {
"geoip.continent_name": {
value: "Asia",
},
},
},
},
pivot: {
group_by: {
customer_id: {
terms: {
field: "customer_id",
missing_bucket: true,
},
},
},
aggregations: {
max_price: {
max: {
field: "taxful_total_price",
},
},
},
},
description: "Maximum priced ecommerce data by customer_id in Asia",
dest: {
index: "kibana_sample_data_ecommerce_transform1",
pipeline: "add_timestamp_pipeline",
},
frequency: "5m",
sync: {
time: {
field: "order_date",
delay: "60s",
},
},
retention_policy: {
time: {
field: "order_date",
max_age: "30d",
},
},
});
response = client.transform.put_transform(
transform_id: "ecommerce_transform1",
body: {
"source": {
"index": "kibana_sample_data_ecommerce",
"query": {
"term": {
"geoip.continent_name": {
"value": "Asia"
}
}
}
},
"pivot": {
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id",
"missing_bucket": true
}
}
},
"aggregations": {
"max_price": {
"max": {
"field": "taxful_total_price"
}
}
}
},
"description": "Maximum priced ecommerce data by customer_id in Asia",
"dest": {
"index": "kibana_sample_data_ecommerce_transform1",
"pipeline": "add_timestamp_pipeline"
},
"frequency": "5m",
"sync": {
"time": {
"field": "order_date",
"delay": "60s"
}
},
"retention_policy": {
"time": {
"field": "order_date",
"max_age": "30d"
}
}
}
)
$resp = $client->transform()->putTransform([
"transform_id" => "ecommerce_transform1",
"body" => [
"source" => [
"index" => "kibana_sample_data_ecommerce",
"query" => [
"term" => [
"geoip.continent_name" => [
"value" => "Asia",
],
],
],
],
"pivot" => [
"group_by" => [
"customer_id" => [
"terms" => [
"field" => "customer_id",
"missing_bucket" => true,
],
],
],
"aggregations" => [
"max_price" => [
"max" => [
"field" => "taxful_total_price",
],
],
],
],
"description" => "Maximum priced ecommerce data by customer_id in Asia",
"dest" => [
"index" => "kibana_sample_data_ecommerce_transform1",
"pipeline" => "add_timestamp_pipeline",
],
"frequency" => "5m",
"sync" => [
"time" => [
"field" => "order_date",
"delay" => "60s",
],
],
"retention_policy" => [
"time" => [
"field" => "order_date",
"max_age" => "30d",
],
],
],
]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"source":{"index":"kibana_sample_data_ecommerce","query":{"term":{"geoip.continent_name":{"value":"Asia"}}}},"pivot":{"group_by":{"customer_id":{"terms":{"field":"customer_id","missing_bucket":true}}},"aggregations":{"max_price":{"max":{"field":"taxful_total_price"}}}},"description":"Maximum priced ecommerce data by customer_id in Asia","dest":{"index":"kibana_sample_data_ecommerce_transform1","pipeline":"add_timestamp_pipeline"},"frequency":"5m","sync":{"time":{"field":"order_date","delay":"60s"}},"retention_policy":{"time":{"field":"order_date","max_age":"30d"}}}' "$ELASTICSEARCH_URL/_transform/ecommerce_transform1"
{
"source": {
"index": "kibana_sample_data_ecommerce",
"query": {
"term": {
"geoip.continent_name": {
"value": "Asia"
}
}
}
},
"pivot": {
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id",
"missing_bucket": true
}
}
},
"aggregations": {
"max_price": {
"max": {
"field": "taxful_total_price"
}
}
}
},
"description": "Maximum priced ecommerce data by customer_id in Asia",
"dest": {
"index": "kibana_sample_data_ecommerce_transform1",
"pipeline": "add_timestamp_pipeline"
},
"frequency": "5m",
"sync": {
"time": {
"field": "order_date",
"delay": "60s"
}
},
"retention_policy": {
"time": {
"field": "order_date",
"max_age": "30d"
}
}
}
{
"source": {
"index": "kibana_sample_data_ecommerce"
},
"latest": {
"unique_key": [
"customer_id"
],
"sort": "order_date"
},
"description": "Latest order for each customer",
"dest": {
"index": "kibana_sample_data_ecommerce_transform2"
},
"frequency": "5m",
"sync": {
"time": {
"field": "order_date",
"delay": "60s"
}
}
}
{
"acknowledged": true
}