Preview a transform
- POST also GET /_transform/{transform_id}/_preview
- POST also GET /_transform/_preview
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.
- Index privileges:
read,view_index_metadata - Cluster privileges:
manage_transform
Path Parameters
-
transform_idstring Idoptional -
Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform configuration details in the request body.
Leave it out to use
/_transform/_preview.
Query Parameters
-
timeoutstring Duration · default: 30s Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
Request
-
destDestination -
The destination for the transform.
-
indexstring IndexName -
The destination index for the transform. The mappings of the destination index are deduced based on the source fields when possible. If alternate mappings are required, use the create index API prior to starting the transform.
-
aliasesDestinationAlias -
The aliases that the destination index for the transform should have. Aliases are manipulated using the stored credentials of the transform, which means the secondary credentials supplied at creation time (if both primary and secondary credentials are specified).
The destination index is added to the aliases regardless of whether the destination index was created by the transform or pre-created by the user.
-
aliasstringrequired -
The name of the alias.
-
move_on_creationboolean · default: false -
Whether the destination index should be the only index in this alias. If
true, all the other indices will be removed from this alias before adding the destination index to this alias. This does not delete the removed indices; it only removes them from the alias. -
pipelinestring -
The unique identifier for an ingest pipeline.
-
descriptionstring -
Free text description of the transform.
-
frequencystring Duration · default: 1m -
The interval between checks for changes in the source indices when the transform is running continuously. Also determines the retry interval in the event of transient failures while the transform is searching or indexing. The minimum value is 1s and the maximum is 1h.
-
pivotPivot -
The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields and the aggregation to reduce the data.
-
aggregationsmap string to AggregationContainer -
Defines how to aggregate the grouped data. The following aggregations are currently supported: average, bucket script, bucket selector, cardinality, filter, geo bounds, geo centroid, geo line, max, median absolute deviation, min, missing, percentiles, rare terms, scripted metric, stats, sum, terms, top metrics, value count, weighted average.
-
group_bymap string to PivotGroupByContainer -
Defines how to group the data. More than one grouping can be defined per pivot. The following groupings are currently supported: date histogram, geotile grid, histogram, terms.
-
<string>PivotGroupByContainer -
date_histogramDateHistogramAggregation -
calendar_intervalCalendarInterval -
Calendar-aware interval. Can be specified using the unit name, such as
month, or as a single unit quantity, such as1M. -
Values:
second1sminute1mhour1hday1dweek1wmonth1Mquarter1qyear1y -
extended_boundsExtendedBoundsFieldDateMath -
Enables extending the bounds of the histogram beyond the data itself.
-
hard_boundsExtendedBoundsFieldDateMath -
Limits the histogram to specified bounds.
-
fieldstring Field -
The date field whose values are use to build a histogram.
-
fixed_intervalstring Duration -
Fixed intervals: a fixed number of SI units and never deviate, regardless of where they fall on the calendar.
-
formatstring -
The date format used to format
key_as_stringin the response. If noformatis specified, the first date format specified in the field mapping is used. -
intervalstring Durationdeprecated -
min_doc_countnumber -
Only returns buckets that have
min_doc_countnumber of documents. By default, all buckets between the first bucket that matches documents and the last one are returned. -
missingDateTime -
The value to apply to documents that do not have a value. By default, documents without a value are ignored.
-
offsetstring Duration -
Changes the start value of each bucket by the specified positive (
+) or negative offset (-) duration. -
orderAggregateOrder -
The sort order of the returned buckets.
-
paramsmap string to object -
scriptstring Script -
time_zonestring -
Time zone used for bucketing and rounding. Defaults to Coordinated Universal Time (UTC).
-
keyedboolean -
Set to
trueto associate a unique string key with each bucket and return the ranges as a hash rather than an array. -
geotile_gridGeoTileGridAggregation -
fieldstring Field -
Field containing indexed
geo_pointorgeo_shapevalues. If the field contains an array,geotile_gridaggregates all array values. -
precisionnumber · default: 7 -
Integer zoom of the key used to define cells/buckets in the results. Values outside of the range [0,29] will be rejected.
-
shard_sizenumber -
Allows for more accurate counting of the top cells returned in the final result the aggregation. Defaults to returning
max(10,(size x number-of-shards))buckets from each shard. -
sizenumber · default: 10000 -
The maximum number of buckets to return.
-
boundsGeoBounds -
A bounding box to filter the geo-points or geo-shapes in each bucket.
-
histogramHistogramAggregation -
extended_boundsExtendedBoundsdouble -
Enables extending the bounds of the histogram beyond the data itself.
-
hard_boundsExtendedBoundsdouble -
Limits the range of buckets in the histogram. It is particularly useful in the case of open data ranges that can result in a very large number of buckets.
-
fieldstring Field -
The name of the field to aggregate on.
-
intervalnumber -
The interval for the buckets. Must be a positive decimal.
-
min_doc_countnumber -
Only returns buckets that have
min_doc_countnumber of documents. By default, the response will fill gaps in the histogram with empty buckets. -
missingnumber -
The value to apply to documents that do not have a value. By default, documents without a value are ignored.
-
offsetnumber -
By default, the bucket keys start with 0 and then continue in even spaced steps of
interval. The bucket boundaries can be shifted by using theoffsetoption. -
orderAggregateOrder -
The sort order of the returned buckets. By default, the returned buckets are sorted by their key ascending.
-
scriptstring Script -
formatstring -
keyedboolean · default: false -
If
true, returns buckets as a hash instead of an array, keyed by the bucket keys. -
termsTermsAggregation -
collect_modeTermsAggregationCollectMode -
Determines how child aggregations should be calculated: breadth-first or depth-first.
Supported values include:
depth_first: Expands all branches of the aggregation tree in one depth-first pass, before any pruning occurs.breadth_first: Caches the set of documents that fall into the uppermost buckets for subsequent replay.
-
Values:
depth_firstbreadth_first -
excludeTermsExclude -
Values to exclude. Accepts regular expressions and partitions.
-
execution_hintTermsAggregationExecutionHint -
Determines whether the aggregation will use field values directly or global ordinals.
-
Values:
mapglobal_ordinalsglobal_ordinals_hashglobal_ordinals_low_cardinality -
fieldstring Field -
The field from which to return terms.
-
includeTermsInclude -
Values to include. Accepts regular expressions and partitions.
-
min_doc_countnumber · default: 1 -
Only return values that are found in more than
min_doc_counthits. -
missingboolean | number | string -
The value to apply to documents that do not have a value. By default, documents without a value are ignored.
-
missing_orderMissingOrder -
Values:
firstlastdefault -
missing_bucketboolean -
value_typestring -
Coerced unmapped fields into the specified type.
-
orderAggregateOrder -
Specifies the sort order of the buckets. Defaults to sorting by descending document count.
-
scriptstring Script -
shard_min_doc_countnumber -
Regulates the certainty a shard has if the term should actually be added to the candidate list or not with respect to the
min_doc_count. Terms will only be considered if their local shard frequency within the set is higher than theshard_min_doc_count. -
shard_sizenumber -
The number of candidate terms produced by each shard. By default,
shard_sizewill be automatically estimated based on the number of shards and thesizeparameter. -
show_term_doc_count_errorboolean -
Set to
trueto return thedoc_count_error_upper_bound, which is an upper bound to the error on thedoc_countreturned by each shard. -
sizenumber · default: 10 -
The number of buckets returned out of the overall terms list.
-
formatstring -
sourceSource -
The source of the data for the transform.
-
indexstring Indicesrequired -
The source indices for the transform. It can be a single index, an index pattern (for example,
"my-index-*""), an array of indices (for example,["my-index-000001", "my-index-000002"]), or an array of index patterns (for example,["my-index-*", "my-other-index-*"]. For remote indices use the syntax"remote_name:index_name". If any indices are in remote clusters then the master node and at least one transform node must have theremote_cluster_clientnode role. -
runtime_mappingsRuntimeFields -
Definitions of search-time runtime fields that can be used by the transform. For search runtime fields all data nodes, including remote nodes, must be 7.12 or later.
-
settingsSettings -
Defines optional transform settings.
-
align_checkpointsboolean · default: true -
Specifies whether the transform checkpoint ranges should be optimized for performance. Such optimization can align checkpoint ranges with the date histogram interval when date histogram is specified as a group source in the transform config. As a result, less document updates in the destination index will be performed thus improving overall performance.
-
dates_as_epoch_millisboolean · default: false -
Defines if dates in the ouput should be written as ISO formatted string or as millis since epoch. epoch_millis was the default for transforms created before version 7.11. For compatible output set this value to
true. -
deduce_mappingsboolean · default: true -
Specifies whether the transform should deduce the destination index mappings from the transform configuration.
-
docs_per_secondnumber -
Specifies a limit on the number of input documents per second. This setting throttles the transform by adding a wait time between search requests. The default value is null, which disables throttling.
-
max_page_search_sizenumber -
Defines the initial page size to use for the composite aggregation for each checkpoint. If circuit breaker exceptions occur, the page size is dynamically adjusted to a lower value. The minimum value is
10and the maximum is65,536. The default value is500forpivottransforms and5000forlatesttransforms. -
use_point_in_timeboolean · default: true -
Specifies whether the transform checkpoint will use the Point In Time API while searching over the source index. In general, Point In Time is an optimization that will reduce pressure on the source index by reducing the amount of refreshes and merges, but it can be expensive if a large number of Point In Times are opened and closed for a given index. The benefits and impact depend on the data being searched, the ingest rate into the source index, and the amount of other consumers searching the same source index.
- Reference
-
num_failure_retriesnumber -
Defines the number of retries on a recoverable failure before the transform task is marked as
failed. The minimum value is0and the maximum is100, where-1indicates that the transform retries indefinitely. If unset, the cluster-level settingnum_transform_failure_retriesis used.This setting cannot be specified when
unattendedistrue, because unattended transforms always retry indefinitely. -
unattendedboolean · default: false -
If
true, the transform runs in unattended mode. In unattended mode, the transform retries indefinitely in case of an error which means the transform never fails. Setting the number of retries other than infinite fails in validation. -
syncSyncContainer -
Defines the properties transforms require to run continuously.
-
timeTimeSync -
Specifies that the transform uses a time field to synchronize the source and destination indices.
-
delaystring Duration · default: 60s -
The time delay between the current time and the latest input data time.
-
fieldstring Fieldrequired -
The date field that is used to identify new documents in the source. In general, it’s a good idea to use a field that contains the ingest timestamp. If you use a different field, you might need to set the delay such that it accounts for data transmission delays.
-
retention_policyRetentionPolicyContainer -
Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the destination index.
-
timeRetentionPolicy -
Specifies that the transform uses a time field to set the retention policy.
-
latestLatest -
The latest method transforms the data by finding the latest document for each unique key.
-
sortstring Fieldrequired -
Specifies the date field that is used to identify the latest documents.
-
unique_keystring Fieldrequired -
Specifies an array of one or more fields that are used to group the data.
Response
-
generated_dest_indexIndexStaterequired -
aliasesmap string to Alias -
<string>Alias -
filterQueryContainer -
Query used to limit documents the alias can access.
-
index_routingstring -
Value used to route indexing operations to a specific shard. If specified, this overwrites the
routingvalue for indexing operations. -
If
true, the alias is hidden. All indices for the alias must have the sameis_hiddenvalue. -
is_write_indexboolean · default: false -
If
true, the index is the write index for the alias. -
routingstring -
Value used to route indexing and search operations to a specific shard.
-
search_routingstring -
Value used to route search operations to a specific shard. If specified, this overwrites the
routingvalue for search operations. -
mappingsTypeMapping -
all_fieldAllField -
analyzerstringrequired -
enabledbooleanrequired -
omit_normsbooleanrequired -
search_analyzerstringrequired -
similaritystringrequired -
storebooleanrequired -
store_term_vector_offsetsbooleanrequired -
store_term_vector_payloadsbooleanrequired -
store_term_vector_positionsbooleanrequired -
store_term_vectorsbooleanrequired -
date_detectionboolean -
dynamicDynamicMapping -
Values:
strictruntimetruefalse -
dynamic_date_formatsstring -
dynamic_templatesstring to DynamicTemplate -
_field_namesFieldNamesField -
enabledbooleanrequired -
index_fieldIndexField -
enabledbooleanrequired -
_metaMetadata -
numeric_detectionboolean -
propertiesmap string to Property -
_sourceSourceField -
runtimemap string to RuntimeField -
<string>RuntimeField -
fieldsmap string to CompositeSubField -
For type
composite -
<string>CompositeSubField -
typeRuntimeFieldTyperequired -
Values:
booleancompositedatedoublegeo_pointgeo_shapeipkeywordlonglookup -
formatstring -
A custom format for
datetype runtime fields. -
input_fieldstring Field -
For type
lookup -
target_fieldstring Field -
For type
lookup -
target_indexstring IndexName -
For type
lookup -
scriptstring Script -
Painless script executed at query time.
-
on_script_errorOnScriptError -
Values:
failcontinue -
typeRuntimeFieldTyperequired -
Field type, which can be:
boolean,composite,date,double,geo_point,ip,keyword,long, orlookup. -
Values:
booleancompositedatedoublegeo_pointgeo_shapeipkeywordlonglookup -
enabledboolean -
subobjectsSubobjects -
Values:
truefalse -
_data_stream_timestampDataStreamTimestamp -
enabledbooleanrequired -
settingsIndexSettings -
defaultsIndexSettings -
Default settings, included when the request's
include_defaultistrue. -
data_streamstring -
lifecycleDataStreamLifecycle -
Data stream lifecycle applicable if this is a data stream.
-
data_retentionstring Duration -
If defined, every document added to this data stream will be stored at least for this time frame. Any time after this duration the document could be deleted. When empty, every document in this data stream will be stored indefinitely.
-
effective_retentionstring Duration -
The least amount of time data should be kept by elasticsearch.
-
retention_determined_byRetentionSource -
Configuration source that can influence the retention of a data stream.
-
Values:
data_stream_configurationdefault_global_retentionmax_global_retentiondefault_failures_retention -
downsamplingDownsamplingRound -
The list of downsampling rounds to execute as part of this downsampling configuration
-
afterstring Durationrequired -
The duration since rollover when this downsampling round should execute
-
fixed_intervalstringrequired -
The downsample interval.
-
downsampling_methodSamplingMethod -
The method used to downsample the data. There are two options
aggregateandlast_value. It requiresdownsamplingto be defined. Defaults toaggregate. -
Values:
aggregatelast_value -
enabledboolean · default: true -
If defined, it turns data stream lifecycle on/off (
true/false) for this data stream. A data stream lifecycle that's disabled (enabled:false) will have no effect on the data stream. -
previewobjectrequired