|
@@ -33,10 +33,13 @@ For more information, see <<built-in-roles>>, <<security-privileges>>, and
|
|
|
== {api-description-title}
|
|
|
|
|
|
This API defines a {transform}, which copies data from source indices,
|
|
|
-transforms it, and persists it into an entity-centric destination index. The
|
|
|
-entities are defined by the set of `group_by` fields in the `pivot` object. You
|
|
|
-can also think of the destination index as a two-dimensional tabular data
|
|
|
-structure (known as a {dataframe}). The ID for each document in the
|
|
|
+transforms it, and persists it into an entity-centric destination index. If you
|
|
|
+choose to use the pivot method for your {transform}, the entities are defined by
|
|
|
+the set of `group_by` fields in the `pivot` object. If you choose to use the
|
|
|
+latest method, the entities are defined by the `unique_key` field values in the
|
|
|
+`latest` object.
|
|
|
+
|
|
|
+You can also think of the destination index as a two-dimensional tabular data structure (known as a {dataframe}). The ID for each document in the
|
|
|
{dataframe} is generated from a hash of the entity, so there is a unique row
|
|
|
per entity. For more information, see <<transforms>>.
|
|
|
|
|
@@ -53,13 +56,14 @@ it had at the time of creation and uses those same roles. If those roles do not
|
|
|
have the required privileges on the source and destination indices, the
|
|
|
{transform} fails when it attempts unauthorized operations.
|
|
|
|
|
|
-IMPORTANT: You must use {kib} or this API to create a {transform}.
|
|
|
- Do not put a {transform} directly into any
|
|
|
- `.transform-internal*` indices using the Elasticsearch index API.
|
|
|
- If {es} {security-features} are enabled, do not give users any
|
|
|
- privileges on `.transform-internal*` indices. If you used transforms
|
|
|
- prior 7.5, also do not give users any privileges on
|
|
|
- `.data-frame-internal*` indices.
|
|
|
+IMPORTANT: You must use {kib} or this API to create a {transform}. Do not put a
|
|
|
+{transform} directly into any `.transform-internal*` indices using the {es}
|
|
|
+index API. If {es} {security-features} are enabled, do not give users any
|
|
|
+privileges on `.transform-internal*` indices. If you used {transforms} prior to
|
|
|
+7.5, also do not give users any privileges on `.data-frame-internal*` indices.
|
|
|
+
|
|
|
+You must choose either the latest or pivot method for your {transform}; you
|
|
|
+cannot use both in a single {transform}.
|
|
|
|
|
|
[[put-transform-path-parms]]
|
|
|
== {api-path-parms-title}
|
|
@@ -106,9 +110,29 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
|
|
|
(Optional, <<time-units, time units>>)
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=frequency]
|
|
|
|
|
|
+//Begin latest
|
|
|
+`latest`::
|
|
|
+(Required^*^, object)
|
|
|
+include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-latest]
|
|
|
++
|
|
|
+.Properties of `latest`
|
|
|
+[%collapsible%open]
|
|
|
+====
|
|
|
+
|
|
|
+`sort`:::
|
|
|
+(Required, string)
|
|
|
+include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-sort]
|
|
|
+
|
|
|
+`unique_key`:::
|
|
|
+(Required, array of strings)
|
|
|
+include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-unique-key]
|
|
|
+
|
|
|
+====
|
|
|
+//End latest
|
|
|
+
|
|
|
//Begin pivot
|
|
|
`pivot`::
|
|
|
-(Required, object)
|
|
|
+(Required^*^, object)
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=pivot]
|
|
|
+
|
|
|
.Properties of `pivot`
|
|
@@ -207,9 +231,11 @@ delays.
|
|
|
[[put-transform-example]]
|
|
|
== {api-examples-title}
|
|
|
|
|
|
+The following {transform} uses the `pivot` method:
|
|
|
+
|
|
|
[source,console]
|
|
|
--------------------------------------------------
|
|
|
-PUT _transform/ecommerce_transform
|
|
|
+PUT _transform/ecommerce_transform1
|
|
|
{
|
|
|
"source": {
|
|
|
"index": "kibana_sample_data_ecommerce",
|
|
@@ -239,7 +265,7 @@ PUT _transform/ecommerce_transform
|
|
|
},
|
|
|
"description": "Maximum priced ecommerce data by customer_id in Asia",
|
|
|
"dest": {
|
|
|
- "index": "kibana_sample_data_ecommerce_transform",
|
|
|
+ "index": "kibana_sample_data_ecommerce_transform1",
|
|
|
"pipeline": "add_timestamp_pipeline"
|
|
|
},
|
|
|
"frequency": "5m",
|
|
@@ -261,3 +287,31 @@ When the {transform} is created, you receive the following results:
|
|
|
"acknowledged" : true
|
|
|
}
|
|
|
----
|
|
|
+
|
|
|
+The following {transform} uses the `latest` method:
|
|
|
+
|
|
|
+[source,console]
|
|
|
+--------------------------------------------------
|
|
|
+PUT _transform/ecommerce_transform2
|
|
|
+{
|
|
|
+ "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"
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+--------------------------------------------------
|
|
|
+// TEST[setup:kibana_sample_data_ecommerce]
|