2019-03-20 13:19:41 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="basic"]
|
2019-09-20 18:57:43 -04:00
|
|
|
[[preview-transform]]
|
2019-12-17 12:01:31 -05:00
|
|
|
=== Preview {transform} API
|
2019-04-30 13:46:13 -04:00
|
|
|
|
|
|
|
[subs="attributes"]
|
2019-03-20 13:19:41 -04:00
|
|
|
++++
|
2019-12-17 12:01:31 -05:00
|
|
|
<titleabbrev>Preview {transform}</titleabbrev>
|
2019-03-20 13:19:41 -04:00
|
|
|
++++
|
|
|
|
|
2019-09-16 11:28:19 -04:00
|
|
|
Previews a {transform}.
|
2019-03-20 13:19:41 -04:00
|
|
|
|
2019-09-20 18:57:43 -04:00
|
|
|
[[preview-transform-request]]
|
2019-06-26 16:46:21 -04:00
|
|
|
==== {api-request-title}
|
2019-03-20 13:19:41 -04:00
|
|
|
|
2019-10-08 02:59:01 -04:00
|
|
|
`POST _transform/_preview`
|
2019-03-20 13:19:41 -04:00
|
|
|
|
2019-09-20 18:57:43 -04:00
|
|
|
[[preview-transform-prereq]]
|
2019-06-26 16:46:21 -04:00
|
|
|
==== {api-prereq-title}
|
2019-06-12 13:13:04 -04:00
|
|
|
|
2020-04-06 11:06:22 -04:00
|
|
|
If the {es} {security-features} are enabled, you must have the following
|
|
|
|
privileges:
|
|
|
|
|
|
|
|
* `manage_transform`
|
|
|
|
* source index: `read`, `view_index_metadata`
|
|
|
|
|
|
|
|
The built-in `transform_admin` role has the `manage_transform` privilege.
|
|
|
|
|
|
|
|
For more information, see <<security-privileges>> and <<built-in-roles>>.
|
|
|
|
|
2019-03-20 13:19:41 -04:00
|
|
|
|
2019-09-20 18:57:43 -04:00
|
|
|
[[preview-transform-desc]]
|
2019-07-05 03:38:21 -04:00
|
|
|
==== {api-description-title}
|
|
|
|
|
|
|
|
This API generates a preview of the results that you will get when you run the
|
2019-09-20 18:57:43 -04:00
|
|
|
<<put-transform,create {transforms} API>> with the same
|
2019-07-05 03:38:21 -04:00
|
|
|
configuration. It returns a maximum of 100 results. The calculations are based
|
2020-03-23 12:40:25 -04:00
|
|
|
on all the current data in the source index.
|
|
|
|
|
|
|
|
It also generates a list of mappings and settings for the destination index.
|
|
|
|
If the destination index does not exist when you start a {transform}, these are
|
|
|
|
the mappings and settings that are used. These values are determined based on
|
|
|
|
the field types of the source index and the {transform} aggregations.
|
|
|
|
|
|
|
|
TIP: There are some <<transform-aggresponse-limitations,limitations>> that
|
|
|
|
might result in poor mappings. As a work-around, create the destination index
|
|
|
|
or an index template with your preferred mappings before you start the
|
|
|
|
{transform}.
|
2019-07-05 03:38:21 -04:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
[role="child_attributes"]
|
2019-09-20 18:57:43 -04:00
|
|
|
[[preview-transform-request-body]]
|
2019-06-26 16:46:21 -04:00
|
|
|
==== {api-request-body-title}
|
|
|
|
|
2019-12-17 12:01:31 -05:00
|
|
|
|
|
|
|
`description`::
|
|
|
|
(Optional, string) Free text description of the {transform}.
|
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
//Begin dest
|
2019-12-17 12:01:31 -05:00
|
|
|
`dest`::
|
|
|
|
(Optional, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest]
|
2020-03-30 14:06:33 -04:00
|
|
|
+
|
|
|
|
.Properties of `dest`
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
|
|
|
`index`:::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Optional, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-index]
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
`pipeline`:::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Optional, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
|
2020-03-30 14:06:33 -04:00
|
|
|
====
|
|
|
|
//End dest
|
2019-07-18 10:58:28 -04:00
|
|
|
|
2019-12-17 12:01:31 -05:00
|
|
|
`frequency`::
|
|
|
|
(Optional, <<time-units, time units>>)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=frequency]
|
2019-06-26 16:46:21 -04:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
//Begin pivot
|
2019-07-10 17:39:38 -04:00
|
|
|
`pivot`::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Required, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=pivot]
|
2020-03-30 14:06:33 -04:00
|
|
|
+
|
|
|
|
.Properties of `pivot`
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
`aggregations` or `aggs`:::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Required, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=pivot-aggs]
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
`group_by`:::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Required, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=pivot-group-by]
|
2020-03-30 14:06:33 -04:00
|
|
|
====
|
|
|
|
//End pivot
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
//Begin source
|
2019-12-17 12:01:31 -05:00
|
|
|
`source`::
|
|
|
|
(Required, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-transforms]
|
2020-03-30 14:06:33 -04:00
|
|
|
+
|
|
|
|
.Properties of `source`
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
`index`:::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Required, string or array)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-index-transforms]
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
`query`:::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Optional, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-query-transforms]
|
2020-03-30 14:06:33 -04:00
|
|
|
====
|
|
|
|
//End source
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
//Begin sync
|
2019-12-17 12:01:31 -05:00
|
|
|
`sync`::
|
|
|
|
(Optional, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync]
|
2020-03-30 14:06:33 -04:00
|
|
|
+
|
|
|
|
.Properties of `sync`
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
|
|
|
//Begin sync.time
|
|
|
|
|
|
|
|
`time`:::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Optional, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time]
|
2020-03-30 14:06:33 -04:00
|
|
|
+
|
|
|
|
.Properties of `analysis_config`
|
|
|
|
[%collapsible%open]
|
|
|
|
=====
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
`delay`::::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Optional, <<time-units, time units>>)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-delay]
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
`field`::::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Optional, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-field]
|
2020-03-30 14:06:33 -04:00
|
|
|
=====
|
|
|
|
//End sync.time
|
|
|
|
====
|
|
|
|
//End sync
|
2019-12-17 12:01:31 -05:00
|
|
|
|
2020-05-11 03:21:36 -04:00
|
|
|
//Begin settings
|
|
|
|
`settings`::
|
|
|
|
(Optional, object)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings]
|
2020-05-11 03:21:36 -04:00
|
|
|
+
|
|
|
|
.Properties of `settings`
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
|
|
|
`docs_per_second`:::
|
|
|
|
(Optional, float)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-docs-per-second]
|
2020-05-11 03:21:36 -04:00
|
|
|
`max_page_search_size`:::
|
|
|
|
(Optional, integer)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-max-page-search-size]
|
2020-05-11 03:21:36 -04:00
|
|
|
====
|
|
|
|
//End settings
|
|
|
|
|
2020-03-30 14:06:33 -04:00
|
|
|
[role="child_attributes"]
|
2019-09-20 18:57:43 -04:00
|
|
|
[[preview-transform-response]]
|
2019-07-05 03:38:21 -04:00
|
|
|
==== {api-response-body-title}
|
|
|
|
|
|
|
|
`preview`::
|
2020-03-30 14:06:33 -04:00
|
|
|
(array) An array of documents. In particular, they are the JSON representation
|
|
|
|
of the documents that would be created in the destination index by the
|
|
|
|
{transform}.
|
|
|
|
|
|
|
|
//Begin generated_dest_index
|
2020-03-23 12:40:25 -04:00
|
|
|
`generated_dest_index`::
|
2020-03-30 14:06:33 -04:00
|
|
|
(object) Contains details about the destination index.
|
|
|
|
+
|
|
|
|
.Properties of `generated_dest_index`
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
|
|
|
|
|
|
|
`aliases`:::
|
|
|
|
(object) The aliases for the destination index.
|
|
|
|
|
|
|
|
`mappings`:::
|
|
|
|
(object) The <<mapping,mappings>> for each document in the destination index.
|
|
|
|
|
|
|
|
`settings`:::
|
|
|
|
(object) The <<index-modules-settings,index settings>> for the destination index.
|
|
|
|
====
|
|
|
|
//End generated_dest_index
|
2019-03-20 13:19:41 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
==== {api-examples-title}
|
2019-03-20 13:19:41 -04:00
|
|
|
|
2019-09-09 13:38:14 -04:00
|
|
|
[source,console]
|
2019-03-20 13:19:41 -04:00
|
|
|
--------------------------------------------------
|
2019-10-08 02:59:01 -04:00
|
|
|
POST _transform/_preview
|
2019-03-20 13:19:41 -04:00
|
|
|
{
|
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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// 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"
|
|
|
|
}
|
|
|
|
...
|
2019-07-02 07:52:14 -04:00
|
|
|
],
|
2020-03-23 12:40:25 -04:00
|
|
|
"generated_dest_index" : {
|
|
|
|
"mappings" : {
|
|
|
|
"_meta" : {
|
|
|
|
"_transform" : {
|
|
|
|
"transform" : "transform-preview",
|
|
|
|
"version" : {
|
|
|
|
"created" : "7.7.0"
|
|
|
|
},
|
|
|
|
"creation_date_in_millis" : 1584738236757
|
|
|
|
},
|
|
|
|
"created_by" : "transform"
|
2019-07-02 07:52:14 -04:00
|
|
|
},
|
2020-03-23 12:40:25 -04:00
|
|
|
"properties" : {
|
|
|
|
"max_price" : {
|
|
|
|
"type" : "half_float"
|
|
|
|
},
|
|
|
|
"customer_id" : {
|
|
|
|
"type" : "keyword"
|
|
|
|
}
|
2019-07-02 07:52:14 -04:00
|
|
|
}
|
2020-03-23 12:40:25 -04:00
|
|
|
},
|
|
|
|
"settings" : {
|
|
|
|
"index" : {
|
|
|
|
"number_of_shards" : "1",
|
|
|
|
"auto_expand_replicas" : "0-1"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"aliases" : { }
|
2019-07-02 07:52:14 -04:00
|
|
|
}
|
2019-03-20 13:19:41 -04:00
|
|
|
}
|
|
|
|
----
|
|
|
|
// NOTCONSOLE
|