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
|
|
|
|
2019-10-17 04:22:38 -04:00
|
|
|
* If the {es} {security-features} are enabled, you must have `manage_transform`
|
|
|
|
cluster privileges to use this API. The built-in `transform_admin` role has
|
|
|
|
these privileges. You must also have `read` and `view_index_metadata` privileges
|
|
|
|
on the source index for the {transform}. 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
|
|
|
|
on all the current data in the source index.
|
|
|
|
|
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}.
|
|
|
|
|
|
|
|
`dest`::
|
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=dest]
|
2019-07-18 10:58:28 -04:00
|
|
|
|
2019-12-17 12:01:31 -05:00
|
|
|
`dest`.`index`:::
|
|
|
|
(Optional, string)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-index]
|
|
|
|
|
|
|
|
`dest`.`pipeline`:::
|
|
|
|
(Optional, string)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
|
2019-07-18 10:58:28 -04:00
|
|
|
|
2019-12-17 12:01:31 -05:00
|
|
|
`frequency`::
|
|
|
|
(Optional, <<time-units, time units>>)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=frequency]
|
2019-06-26 16:46:21 -04:00
|
|
|
|
2019-07-10 17:39:38 -04:00
|
|
|
`pivot`::
|
2019-12-17 12:01:31 -05:00
|
|
|
(Required, object)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=pivot]
|
|
|
|
|
|
|
|
`pivot`.`aggregations` or `aggs`:::
|
|
|
|
(Required, object)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=pivot-aggs]
|
|
|
|
|
|
|
|
`pivot`.`group_by`:::
|
|
|
|
(Required, object)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=pivot-group-by]
|
|
|
|
|
|
|
|
`pivot`.`max_page_search_size`:::
|
|
|
|
(Optional, integer)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=pivot-max-page-search-size]
|
|
|
|
|
|
|
|
`source`::
|
|
|
|
(Required, object)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=source-transforms]
|
|
|
|
|
|
|
|
`source`.`index`:::
|
|
|
|
(Required, string or array)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=source-index-transforms]
|
|
|
|
|
|
|
|
`source`.`query`:::
|
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=source-query-transforms]
|
|
|
|
|
|
|
|
`sync`::
|
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=sync]
|
2019-07-05 03:38:21 -04:00
|
|
|
|
2019-12-17 12:01:31 -05:00
|
|
|
`sync`.`time`:::
|
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time]
|
|
|
|
|
|
|
|
`sync`.`time`.`delay`::::
|
|
|
|
(Optional, <<time-units, time units>>)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time-delay]
|
|
|
|
|
|
|
|
`sync`.`time`.`field`::::
|
|
|
|
(Optional, string)
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time-field]
|
|
|
|
|
|
|
|
|
2019-09-20 18:57:43 -04:00
|
|
|
[[preview-transform-response]]
|
2019-07-05 03:38:21 -04:00
|
|
|
==== {api-response-body-title}
|
|
|
|
|
|
|
|
`preview`::
|
|
|
|
(array) An array of documents. In particular, they are the JSON
|
|
|
|
representation of the documents that would be created in the destination index
|
2019-09-16 11:28:19 -04:00
|
|
|
by the {transform}.
|
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
|
|
|
],
|
|
|
|
"mappings": {
|
|
|
|
"properties": {
|
|
|
|
"max_price": {
|
|
|
|
"type": "double"
|
|
|
|
},
|
|
|
|
"customer_id": {
|
|
|
|
"type": "keyword"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-20 13:19:41 -04:00
|
|
|
}
|
|
|
|
----
|
|
|
|
// NOTCONSOLE
|