[[reference-transform-preview_transform]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
=== client.transform.previewTransform

Preview a transform. Generates a preview of the results that you will get when you create a transform with the same configuration. It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also generates a list of mappings and settings for the destination index. These values are determined based on the field types of the source index and the transform aggregations.

{ref}/preview-transform.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(TransformPreviewTransformRequest, options?): Promise<TransformPreviewTransformResponse>
----

[discrete]
===== `TransformPreviewTransformRequest`

[source,ts]
----
interface TransformPreviewTransformRequest extends <<shared-type-request-base, RequestBase>> {
  transform_id?: <<shared-type-id, Id>>
  timeout?: <<shared-type-duration, Duration>>
  dest?: TransformDestination
  description?: string
  frequency?: <<shared-type-duration, Duration>>
  pivot?: TransformPivot
  source?: TransformSource
  settings?: TransformSettings
  sync?: TransformSyncContainer
  retention_policy?: TransformRetentionPolicyContainer
  latest?: TransformLatest
}
----

[discrete]
===== `TransformPreviewTransformResponse`

[source,ts]
----
interface TransformPreviewTransformResponse<TTransform = unknown> {
  generated_dest_index: IndicesIndexState
  preview: TTransform[]
}
----

