diff --git a/explore-analyze/alerting/alerts/rule-types.md b/explore-analyze/alerting/alerts/rule-types.md index cd586f6fb36..3f9a7f1b556 100644 --- a/explore-analyze/alerting/alerts/rule-types.md +++ b/explore-analyze/alerting/alerts/rule-types.md @@ -25,7 +25,7 @@ Some rule types are subscription features, while others are free features. For a | --- | --- | | [{{es}} query](rule-type-es-query.md) | Run a user-configured {{es}} query, compare the number of matches to a configured threshold, and schedule actions to run when the threshold condition is met. | | [Index threshold](rule-type-index-threshold.md) | Aggregate field values from documents using {{es}} queries, compare them to threshold values, and schedule actions to run when the thresholds are met. | -| [Transform rules](../../transforms/transform-alerts.md) | {applies_to}`stack: beta` {applies_to}`serverless: beta` Run scheduled checks on a {{ctransform}} to check its health. If a {{ctransform}} meets the conditions, an alert is created and the associated action is triggered. | +| [Transform rules](../../transforms/transform-alerts.md) | Run scheduled checks on a {{ctransform}} to check its health. If a {{ctransform}} meets the conditions, an alert is created and the associated action is triggered. | | [Tracking containment](geo-alerting.md) | Run an {{es}} query to determine if any documents are currently contained in any boundaries from a specified boundary index and generate alerts when a rule’s conditions are met. | ## {{observability}} rules [observability-rules] diff --git a/explore-analyze/transforms/ecommerce-transforms.md b/explore-analyze/transforms/ecommerce-transforms.md index 8263d47ddeb..37517773965 100644 --- a/explore-analyze/transforms/ecommerce-transforms.md +++ b/explore-analyze/transforms/ecommerce-transforms.md @@ -30,7 +30,7 @@ products: ::: ::::{tip} - On {{serverless-full}}, when your project has [linked projects](/explore-analyze/cross-project-search.md), use the **Project scope** control next to the data view picker to choose which linked projects the transform searches. Refer to [Cross-project search scope](transform-overview.md#transform-cps-scope). + On {{serverless-full}}, when your project has [linked projects](/explore-analyze/cross-project-search.md), use the **Project scope** control next to the data view picker to choose which linked projects the transform searches. Refer to [Source data from linked projects](transform-overview.md#transform-cps-scope). :::: Group the data by customer ID and add one or more aggregations to learn more about each customer’s orders. For example, let’s calculate the sum of products they purchased, the total price of their purchases, the maximum number of products that they purchased in a single order, and their total number of orders. We’ll accomplish this by using the [`sum` aggregation](elasticsearch://reference/aggregations/search-aggregations-metrics-sum-aggregation.md) on the `total_quantity` and `taxless_total_price` fields, the [`max` aggregation](elasticsearch://reference/aggregations/search-aggregations-metrics-max-aggregation.md) on the `total_quantity` field, and the [`cardinality` aggregation](elasticsearch://reference/aggregations/search-aggregations-metrics-cardinality-aggregation.md) on the `order_id` field: @@ -253,6 +253,8 @@ products: :::: + {applies_to}`serverless: ga` On {{serverless-short}}, transforms do not set the number of shards or replicas of the destination index, so the preview does not include these settings. + In some instances the deduced mappings might be incompatible with the actual data. For example, numeric overflows might occur or dynamically mapped fields might contain both numbers and strings. To avoid this problem, create your destination index before you start the transform. For more information, see the [create index API]({{es-apis}}operation/operation-indices-create). ::::{dropdown} API example @@ -306,7 +308,7 @@ products: ::: ::::{tip} - On {{serverless-full}}, when your project has [linked projects](/explore-analyze/cross-project-search.md), the **Project scope** column on this page shows which projects each transform searches. Refer to [Cross-project search scope](transform-overview.md#transform-cps-scope). + On {{serverless-full}}, when your project has [linked projects](/explore-analyze/cross-project-search.md), the **Project scope** column on this page shows which projects each transform searches. Refer to [Source data from linked projects](transform-overview.md#transform-cps-scope). :::: Alternatively, you can use the [start transforms]({{es-apis}}operation/operation-transform-start-transform), [stop transforms]({{es-apis}}operation/operation-transform-stop-transform) and [reset transforms]({{es-apis}}operation/operation-transform-reset-transform) APIs. diff --git a/explore-analyze/transforms/transform-checkpoints.md b/explore-analyze/transforms/transform-checkpoints.md index 63a7c385a6f..810fff1d19c 100644 --- a/explore-analyze/transforms/transform-checkpoints.md +++ b/explore-analyze/transforms/transform-checkpoints.md @@ -45,7 +45,7 @@ If the cluster experiences unsuitable performance degradation due to the transfo In most cases, it is strongly recommended to use the ingest timestamp of the source indices for syncing the transform. This is the most optimal way for transforms to be able to identify new changes. If your data source follows the [ECS standard](ecs://reference/index.md), you might already have an [`event.ingested`](ecs://reference/ecs-event.md#field-event-ingested) field. In this case, use `event.ingested` as the `sync`.`time`.`field` property of your transform. -If you don't have a `event.ingested` field or it isn't populated, you can set it by using an ingest pipeline. Create an ingest pipeline either using the [ingest pipeline API]({{es-apis}}operation/operation-ingest-put-pipeline) (like the example below) or through {{kib}}'s **Ingest Pipelines** management page. Use a [`set` processor](elasticsearch://reference/enrich-processor/set-processor.md) to set the field and associate it with the value of the ingest timestamp. +If you don't have a `event.ingested` field or it isn't populated, you can set it by using an ingest pipeline. Create an ingest pipeline either using the [ingest pipeline API]({{es-apis}}operation/operation-ingest-put-pipeline) (like the following example) or through {{kib}}'s **Ingest Pipelines** management page. Use a [`set` processor](elasticsearch://reference/ingest-processor/set-processor.md) to set the field and associate it with the value of the ingest timestamp. ```console PUT _ingest/pipeline/set_ingest_time @@ -80,8 +80,12 @@ Failures in transforms tend to be related to searching or indexing. To increase Checkpoint failures can be categorized as follows: -* Temporary failures: The checkpoint is retried. If 10 consecutive failures occur, the transform has a failed status. For example, this situation might occur when there are shard failures and queries return only partial results. -* Irrecoverable failures: The transform immediately fails. For example, this situation occurs when the source index is not found. +* Temporary failures: The checkpoint is retried up to `num_failure_retries` times (default 10) with an exponential backoff, starting at 5 seconds and capped at 1 hour. Once the retries are exhausted, the transform fails and stops. For example, this situation might occur when there are shard failures and queries return only partial results. You can change the default for all transforms with the `xpack.transform.num_transform_failure_retries` cluster setting. A value of `-1` retries indefinitely. + + {applies_to}`stack: ga 9.6+` Authentication and authorization errors are also treated as temporary failures and retried. +* Irrecoverable failures: The transform immediately fails. For example, this situation occurs when the source index is not found, or when an aggregation is not valid for the field type. * Adjustment failures: The transform retries with adjusted settings. For example, if a parent circuit breaker memory errors occur during the composite aggregation, the transform receives partial results. The aggregated search is retried with a smaller number of buckets. This retry is performed at the interval defined in the `frequency` property for the transform. If the search is retried to the point where it reaches a minimal number of buckets, an irrecoverable failure occurs. +A transform with the `unattended` setting enabled never enters a failed state. It retries all failures indefinitely. + If the node running the transforms fails, the transform restarts from the most recent persisted cursor position. This recovery process might repeat some of the work the transform had already done, but it ensures data consistency. diff --git a/explore-analyze/transforms/transform-examples.md b/explore-analyze/transforms/transform-examples.md index 59f2ee0088e..d524b468cdc 100644 --- a/explore-analyze/transforms/transform-examples.md +++ b/explore-analyze/transforms/transform-examples.md @@ -257,7 +257,7 @@ The search result shows you data like this for each client IP: }, "success" : 2, "error404" : 0, - "error503" : 0, + "error5xx" : 0, "clientip" : "0.72.176.46", "agent_dc" : 2.0, "bytes_sum" : 4422.0, @@ -506,6 +506,32 @@ The API call above returns a response similar to this: } ``` +{applies_to}`stack: ga 9.6+` {applies_to}`serverless: ga` Each `top_metrics` result also contains a `top` array with the sort values and metrics of the top documents, in the same format as the `top_metrics` aggregation response in a search. For example, the first document of the preview looks similar to this: + +```js +{ + "top" : { + "clientip" : "223.87.60.27", + "geo.src" : "IN", + "top" : [ + { + "sort" : [ 6219 ], + "metrics" : { + "clientip" : "223.87.60.27", + "geo.src" : "IN" + } + } + ] + }, + "bytes" : { + "max" : 6219 + }, + "timestamp" : "2021-04-25T00:00:00.000Z" +} +``` + +If you set the `size` parameter of `top_metrics` to a value greater than 1, the `top` array contains up to `size` entries, while the flattened fields contain the metrics of the first document. If you create the destination index yourself with `dynamic` set to `strict`, add the `top` field to its mappings. + ## Getting customer name and email address by customer ID [example-customer-names] This example uses the ecommerce sample data set to create an entity-centric index based on customer ID, and to get the customer name and email address by using the `top_metrics` aggregation. @@ -586,3 +612,5 @@ The API returns a response that is similar to this: ] } ``` + +{applies_to}`stack: ga 9.6+` {applies_to}`serverless: ga` The `last` object also contains a `top` array with the sort value and metrics of the top document, as described in the [previous example](#example-bytes). diff --git a/explore-analyze/transforms/transform-limitations.md b/explore-analyze/transforms/transform-limitations.md index ebe8da57279..b3ccce1c522 100644 --- a/explore-analyze/transforms/transform-limitations.md +++ b/explore-analyze/transforms/transform-limitations.md @@ -19,11 +19,15 @@ The following limitations and known problems apply to the Elastic transform feat ## Configuration limitations [transform-config-limitations] -### Field names prefixed with underscores are omitted from latest transforms [transforms-underscore-limitation] +### Field names prefixed with underscores are omitted from the destination index [transforms-underscore-limitation] -If you use the `latest` type of transform and the source index has field names that start with an underscore (_) character, they are assumed to be internal fields. Those fields are omitted from the documents in the destination index. +Top-level field names that start with an underscore (_) character are assumed to be internal fields and are omitted from the documents in the destination index. For `latest` transforms, this applies to fields in the source documents. For `pivot` transforms, this applies to `group_by` and aggregation names, so don't start these names with an underscore. ### Transforms support {{ccs}} if the remote cluster is configured properly [transforms-ccs-limitation] +```{applies_to} +stack: ga +serverless: unavailable +``` If you use [{{ccs}}](../../explore-analyze/cross-cluster-search.md), the remote cluster must support the search and aggregations you use in your transforms. Transforms validate their configuration; if you use {{ccs}} and the validation fails, make sure that the remote cluster supports the query and aggregations you use. @@ -45,7 +49,11 @@ Transforms sort data by a user-defined time field, which is frequently accessed. ### {{ctransform-cap}} scheduling limitations [transform-scheduling-limitations] -A {{ctransform}} periodically checks for changes to source data. The functionality of the scheduler is currently limited to a basic periodic timer which can be within the `frequency` range from 1s to 1h. The default is 1m. This is designed to run little and often. When choosing a `frequency` for this timer consider your ingest rate along with the impact that the transform search/index operations has other users in your cluster. Also, retries occur at `frequency` interval. +A {{ctransform}} periodically checks for changes to source data. The functionality of the scheduler is currently limited to a basic periodic timer which can be within the `frequency` range from 1s to 1h. The default is 1m. This is designed to run little and often. When choosing a `frequency` for this timer consider your ingest rate along with the impact that the search/index operations has on other users in your cluster. + +{applies_to}`serverless: ga` On {{serverless-short}}, a `frequency` lower than 5s is treated as 5s. + +After a failure, the transform does not wait for the `frequency` interval before it retries. Instead, it retries with an exponential backoff that starts at 5 seconds and is capped at 1 hour. ## Operational limitations [transform-operational-limitations] @@ -57,9 +65,9 @@ You can view the deduced mappings by using the [preview transform API]({{es-apis If it’s required, you may define custom mappings prior to starting the transform by creating a custom destination index using the [create index API]({{es-apis}}operation/operation-indices-create). As deduced mappings cannot be overwritten by an index template, use the create index API to define custom mappings. The index templates only apply to fields derived from scripts that use dynamic mappings. -### Batch transforms may not account for changed documents [transform-batch-limitations] +### Batch transforms without point in time might not account for changed documents [transform-batch-limitations] -A batch transform uses a [composite aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-composite-aggregation.md) which allows efficient pagination through all buckets. Composite aggregations do not yet support a search context, therefore if the source data is changed (deleted, updated, added) while the batch {{dataframe}} is in progress, then the results may not include these changes. +A batch transform uses a [composite aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-composite-aggregation.md) which allows efficient pagination through all buckets. By default, transforms page through the source with a [point in time]({{es-apis}}operation/operation-open-point-in-time), which gives the search a consistent view of the data. Point in time is not used when `use_point_in_time` is set to `false`, when the source includes remote clusters, or when {{cps}} is enabled. When point in time is turned off, if the source data is changed (deleted, updated, added) while the batch {{dataframe}} is in progress, then the results might not include these changes. ### {{ctransform-cap}} consistency does not account for deleted or updated documents [transform-consistency-limitations] @@ -71,9 +79,9 @@ If the indices that fall within the scope of the source index pattern are remove Depending on your use case, you may wish to recreate the transform entirely after deletions. Alternatively, if your use case is tolerant to historical archiving, you may wish to include a max ingest timestamp in your aggregation. This will allow you to exclude results that have not been recently updated when viewing the destination index. -### Deleting a transform does not delete the destination index or {{kib}} index pattern [transform-deletion-limitations] +### Deleting a transform does not delete the destination index by default [transform-deletion-limitations] -When deleting a transform using `DELETE _transform/index` neither the destination index nor the {{kib}} index pattern, should one have been created, are deleted. These objects must be deleted separately. +By default, deleting a transform with `DELETE _transform/` deletes neither the destination index nor the {{kib}} data view, if one was created. To also delete the destination index, use the `delete_dest_index=true` query parameter of the [delete transform API]({{es-apis}}operation/operation-transform-delete-transform). Delete the data view separately. ### Handling dynamic adjustment of aggregation page size [transform-aggregation-page-limitations] @@ -81,15 +89,15 @@ During the development of transforms, control was favoured over performance. In Composite aggregations are well suited for high cardinality data enabling pagination through results. If a [circuit breaker](elasticsearch://reference/elasticsearch/configuration-reference/circuit-breaker-settings.md) memory exception occurs when performing the composite aggregated search then we try again reducing the number of buckets requested. This circuit breaker is calculated based upon all activity within the cluster, not just activity from transforms, so it therefore may only be a temporary resource availability issue. -For a batch transform, the number of buckets requested is only ever adjusted downwards. The lowering of value may result in a longer duration for the transform checkpoint to complete. For {{ctransforms}}, the number of buckets requested is reset back to its default at the start of every checkpoint and it is possible for circuit breaker exceptions to occur repeatedly in the {{es}} logs. +For a batch transform, the number of buckets requested is only ever adjusted downwards. The lowering of value might result in a longer duration for the transform checkpoint to complete. For {{ctransforms}}, the number of buckets requested is reset back to the configured `max_page_search_size` when a checkpoint completes. -The transform retrieves data in batches which means it calculates several buckets at once. Per default this is 500 buckets per search/index operation. The default can be changed using `max_page_search_size` and the minimum value is 10. If failures still occur once the number of buckets requested has been reduced to its minimum, then the transform will be set to a failed state. +The transform retrieves data in batches which means it calculates several buckets at once. By default, this is 500 buckets per search/index operation for `pivot` transforms and 5000 for `latest` transforms. You can change the default using `max_page_search_size`. The minimum value is 10 and the maximum is 65,536. If failures still occur once the number of buckets requested has been reduced to its minimum, then the transform will be set to a failed state, unless it runs in `unattended` mode, in which case it keeps retrying. ### Handling dynamic adjustments for many terms [transform-dynamic-adjustments-limitations] For each checkpoint, entities are identified that have changed since the last time the check was performed. This list of changed entities is supplied as a [terms query](elasticsearch://reference/query-languages/query-dsl/query-dsl-terms-query.md) to the transform composite aggregation, one page at a time. Then updates are applied to the destination index for each page of entities. -The page `size` is defined by `max_page_search_size` which is also used to define the number of buckets returned by the composite aggregation search. The default value is 500, the minimum is 10. +The page `size` is defined by `max_page_search_size` which is also used to define the number of buckets returned by the composite aggregation search. The default value is 500 for `pivot` transforms and 5000 for `latest` transforms. The minimum is 10. The index setting [`index.max_terms_count`](elasticsearch://reference/elasticsearch/index-settings/index-modules.md#dynamic-index-settings) defines the maximum number of terms that can be used in a terms query. The default value is 65536. If `max_page_search_size` exceeds `index.max_terms_count` the transform will fail. @@ -99,7 +107,7 @@ Using smaller values for `max_page_search_size` may result in a longer duration Failed transforms remain as a persistent task and should be handled appropriately, either by deleting it or by resolving the root cause of the failure and re-starting. -When using the API to delete a failed transform, first stop it using `_stop?force=true`, then delete it. +To delete a failed transform with the API, use `DELETE _transform/?force=true`. Alternatively, stop it first using `_stop?force=true`, then delete it. ### {{ctransforms-cap}} may give incorrect results if documents are not yet available to search [transform-availability-limitations] @@ -121,9 +129,12 @@ Transforms update data in the destination index which requires writing into the [ILM](../../manage-data/lifecycle/index-lifecycle-management.md) is not recommended to use as a transform destination index. Transforms update documents in the current destination, and cannot delete documents in the indices previously used by ILM. This may lead to duplicated documents when you use transforms combined with ILM in case of a rollover. -If you use ILM to have time-based indices, consider using the [Date index name](elasticsearch://reference/enrich-processor/date-index-name-processor.md) instead. The processor works without duplicated documents if your transform contains a `group_by` based on `date_histogram`. +If you use ILM to have time-based indices, consider using the [Date index name](elasticsearch://reference/ingest-processor/date-index-name-processor.md) instead. The processor works without duplicated documents if your transform contains a `group_by` based on `date_histogram`. ### SLO transforms at scale may misreport state and increase PIT activity +```{applies_to} +stack: ga +``` When running a large number of SLO transforms, two types of limitations can appear: diff --git a/explore-analyze/transforms/transform-overview.md b/explore-analyze/transforms/transform-overview.md index 1f5f8e2f6c9..c6258871b98 100644 --- a/explore-analyze/transforms/transform-overview.md +++ b/explore-analyze/transforms/transform-overview.md @@ -20,7 +20,7 @@ You can choose either of the following methods to transform your data: [pivot](# :::: -Transforms are persistent tasks; they are stored in cluster state which makes them resilient for node failures. Refer to [How checkpoints work](transform-checkpoints.md) and [Error handling](transform-checkpoints.md#ml-transform-checkpoint-errors) to learn more about the machinery behind transforms. +Transforms are persistent tasks. They are stored in cluster state, which makes them resilient for node failures. Their configuration, state, and checkpoints are stored in internal {{es}} indices. Refer to [How checkpoints work](transform-checkpoints.md) and [Error handling](transform-checkpoints.md#ml-transform-checkpoint-errors) to learn more about the machinery behind transforms. ## Pivot transforms [pivot-transform-overview] @@ -30,13 +30,13 @@ A lot of {{es}} indices are organized as a stream of events: each event is an in Transforms enable you to define a pivot, which is a set of features that transform the index into a different, more digestible format. Pivoting results in a summary of your data in a new index. -To define a pivot, first you select one or more fields that you will use to group your data. You can select categorical fields (terms) and numerical fields for grouping. If you use numerical fields, the field values are bucketed using an interval that you specify. +To define a pivot, first you select one or more fields that you will use to group your data. You can group by categorical fields (`terms`), by numerical fields (`histogram`), by date fields (`date_histogram`), and by geo-point fields (`geotile_grid`). If you use numerical or date fields, the field values are bucketed using an interval that you specify. The second step is deciding how you want to aggregate the grouped data. When using aggregations, you practically ask questions about the index. There are different types of aggregations, each with its own purpose and output. To learn more about the supported aggregations and group-by fields, see [Create transform]({{es-apis}}operation/operation-transform-put-transform). As an optional step, you can also add a query to further limit the scope of the aggregation. -The transform performs a composite aggregation that paginates through all the data defined by the source index query. The output of the aggregation is stored in a *destination index*. Each time the transform queries the source index, it creates a *checkpoint*. You can decide whether you want the transform to run once or continuously. A *batch transform* is a single operation that has a single checkpoint. *{{ctransforms-cap}}* continually increment and process checkpoints as new source data is ingested. +The transform performs a composite aggregation that paginates through all the data defined by the source index query. The output of the aggregation is stored in a *destination index*. Each time the transform processes the source data, it creates a *checkpoint*. A {{ctransform}} only creates a new checkpoint when it detects changes in the source data. You can decide whether you want the transform to run once or continuously. A *batch transform* is a single operation that has a single checkpoint. *{{ctransforms-cap}}* continually increment and process checkpoints as new source data is ingested. Imagine that you run a webshop that sells clothes. Every order creates a document that contains a unique order ID, the name and the category of the ordered product, its price, the ordered quantity, the exact date of the order, and some customer information (name, gender, location, and so on). Your data set contains all the transactions from last year. @@ -90,7 +90,12 @@ The default scope depends on how you create the transform: * **In {{kib}}**: Uses your space's default scope. * **With Clone**: Keeps the original transform's scope. -* **Through the API, or before {{cps-init}} was available**: Searches only the origin project until you set `project_routing`. +* **Through the API**: The scope doesn't depend on your {{kib}} space. Instead, it depends on the API key that authenticates the request: + * With an [{{ecloud}} API key](/deploy-manage/api-keys/elastic-cloud-api-keys.md), the transform searches all linked projects unless you specify a `project_routing` expression. + * With an [{{es}} API key](/deploy-manage/api-keys/serverless-project-api-keys.md), which is scoped to a single project, the transform searches only the origin project. +* **Before {{cps-init}} was available**: Searches only the origin project until you set `project_routing`. + +Changes to the space default scope do not affect existing transforms. Each transform keeps the `project_routing` that was set when it was created or last updated. To change the scope later: * Edit the transform in {{kib}}. @@ -101,7 +106,7 @@ To change the scope later: The **Transforms** management page shows each transform's scope in the **Project scope** column: -* **This project**: Searches the origin project only, either because only the origin project is specified, or because no `project_routing` is specified. +* **This project**: Searches the origin project only. * **All**: Searches every linked project. * A count such as **5/10**: Searches a custom subset of projects. This might or might not include the origin project. diff --git a/explore-analyze/transforms/transform-painless-examples.md b/explore-analyze/transforms/transform-painless-examples.md index 8423881ef17..a4fda8ebb37 100644 --- a/explore-analyze/transforms/transform-painless-examples.md +++ b/explore-analyze/transforms/transform-painless-examples.md @@ -98,6 +98,8 @@ You can retrieve the last value in a similar way: ### Getting top hits by using stored scripts [top-hits-stored-scripts] +This example uses a `scripted_metric` aggregation which is not supported on {{es}} Serverless. + You can also use the power of [stored scripts]({{es-apis}}operation/operation-put-script) to get the latest value. Stored scripts are updatable, enable collaboration, and avoid duplication across queries. 1. Create the stored scripts: @@ -381,7 +383,6 @@ This example shows how to derive multiple features from a single transaction. Le ```js { "_index":"apache-sessions", - "_type":"_doc", "_id":"KvzSeGoB4bgw0KGbE3wP", "_score":1.0, "_source":{ @@ -492,10 +493,10 @@ POST _transform/_preview 1. The data is grouped by `sessionid`. 2. The aggregations counts the number of paths and enumerate the viewed pages during the session. -3. The `init_script` creates an array type `doc` in the `state` object. -4. The `map_script` defines a `span` array with a timestamp, a URL, and a referrer value which are based on the corresponding values of the document, then adds the value of the `span` array to the `doc` object. +3. The `init_script` creates a list called `docs` in the `state` object. +4. The `map_script` defines a `span` map with a timestamp, a URL, and a referrer value which are based on the corresponding values of the document, then adds the `span` map to the `state.docs` list. 5. The `combine_script` returns `state.docs` from each shard. -6. The `reduce_script` defines various objects like `min_time`, `max_time`, and `duration` based on the document fields, then declares a `ret` object, and copies the source document by using `new HashMap ()`. Next, the script defines `first_time`, `last_time`, `duration` and other fields inside the `ret` object based on the corresponding object defined earlier, finally returns `ret`. +6. The `reduce_script` defines various objects like `min_time`, `max_time`, and `duration` based on the document fields, then declares an empty `ret` map by using `new HashMap()`. Next, the script defines `first_time`, `last_time`, `duration` and other fields inside the `ret` object based on the corresponding object defined earlier, finally returns `ret`. The API call results in a similar response: diff --git a/explore-analyze/transforms/transform-scale.md b/explore-analyze/transforms/transform-scale.md index c1fc49b5e2f..71495eb27d5 100644 --- a/explore-analyze/transforms/transform-scale.md +++ b/explore-analyze/transforms/transform-scale.md @@ -11,7 +11,7 @@ products: # Transforms at scale [transform-scale] -Transforms convert existing {{es}} indices into summarized indices, which provide opportunities for new insights and analytics. The search and index operations performed by transforms use standard {{es}} features so similar considerations for working with {{es}} at scale are often applicable to transforms. If you experience performance issues, start by identifying the bottleneck areas (search, indexing, processing, or storage) then review the relevant considerations in this guide to improve performance. It also helps to understand how transforms work as different considerations apply depending on whether or not your transform is running in continuous mode or in batch. +Transforms convert existing {{es}} indices into summarized indices, which provide opportunities for new insights and analytics. The search and index operations performed by transforms use standard {{es}} features, so similar considerations for working with {{es}} at scale are often applicable to transforms. If you experience performance issues, start by identifying the bottleneck areas (search, indexing, processing, or storage) then review the relevant considerations in this guide to improve performance. It also helps to understand how transforms work as different considerations apply depending on whether your transform is running in continuous mode or in batch. In this guide, you’ll learn how to: @@ -19,7 +19,7 @@ In this guide, you’ll learn how to: **Prerequisites:** -These guildelines assume you have a transform you want to tune, and you’re already familiar with: +These guidelines assume you have a transform you want to tune, and you’re already familiar with: * [How transforms work](transform-overview.md). * [How to set up transforms](transform-setup.md). @@ -39,7 +39,11 @@ In a {{ctransform}}, the `frequency` configuration option sets the interval betw ## 2. Increase the number of shards of the destination index (index) [increase-shards-dest-index] -Depending on the size of the destination index, you may consider increasing its shard count. Transforms use one shard by default when creating the destination index. To override the index settings, create the destination index before starting the transform. For more information about how the number of shards affects scalability and resilience, refer to [Get ready for production](../../deploy-manage/index.md) +Depending on the size of the destination index, you might consider increasing its shard count. + +{applies_to}`stack: ga` Transforms use one shard by default when creating the destination index. + +To override the index settings, create the destination index before starting the transform. For more information about how the number of shards affects scalability and resilience, refer to [Run {{es}} in production](../../deploy-manage/production-guidance/elasticsearch-in-production-environments.md). ::::{tip} Use the [Preview transform]({{es-apis}}operation/operation-transform-preview-transform) to check the settings that the transform would use to create the destination index. You can copy and adjust these in order to create the destination index prior to starting the transform. @@ -55,7 +59,7 @@ Transforms execute standard {{es}} search requests. There are different ways to Imagine your {{ctransform}} is configured to group by `IP` and calculate the sum of `bytes_sent`. For each checkpoint, a {{ctransform}} detects changes in the source data since the previous checkpoint, identifying the IPs for which new data has been ingested. Then it performs a second search, filtered for this group of IPs, in order to calculate the total `bytes_sent`. If this second search matches many shards, then this could be resource intensive. Consider limiting the scope that the source index pattern and query will match. -To limit which historical indices are accessed, exclude certain tiers (for example `"must_not": { "terms": { "_tier": [ "data_frozen", "data_cold" ] } }` or use an absolute time value as a date range filter in your source query (for example, greater than 2024-01-01T00:00:00). If you use a relative time value (for example, gte now-30d/d) then ensure date rounding is applied to take advantage of query caching and ensure that the relative time is much larger than the largest of `frequency` or `time.sync.delay` or the date histogram bucket, otherwise data may be missed. Do not use date filters which are less than a date value (for example, `lt`: less than or `lte`: less than or equal to) as this conflicts with the logic applied at each checkpoint execution and data may be missed. +To limit which historical indices are accessed, exclude certain tiers (for example `"must_not": { "terms": { "_tier": [ "data_frozen", "data_cold" ] } }` or use an absolute time value as a date range filter in your source query (for example, greater than 2024-01-01T00:00:00). If you use a relative time value (for example, gte now-30d/d) then ensure date rounding is applied to take advantage of query caching and ensure that the relative time is much larger than the largest of `frequency` or `sync.time.delay` or the date histogram bucket, otherwise data might be missed. Do not use date filters which are less than a date value (for example, `lt`: less than or `lte`: less than or equal to) as this conflicts with the logic applied at each checkpoint execution and data might be missed. Consider using [date math](elasticsearch://reference/elasticsearch/rest-apis/api-conventions.md#api-date-math-index-names) in your index names to reduce the number of indices to resolve in your queries. Add a date pattern - for example, `yyyy-MM-dd` - to your index names and use it to limit your query to a specific date. The example below queries indices only from yesterday and today: @@ -76,7 +80,7 @@ Too few shards may mean that the benefits of distributing the workload cannot be ## 6. Tune `max_page_search_size` (search) [tune-max-page-search-size] -The `max_page_search_size` transform configuration option defines the number of buckets that are returned for each search request. The default value is 500. If you increase this value, you get better throughput at the cost of higher latency and memory usage. +The `max_page_search_size` transform configuration option defines the number of buckets that are returned for each search request. The default value is 500 for `pivot` transforms and 5000 for `latest` transforms. If you increase this value, you get better throughput at the cost of higher latency and memory usage. The ideal value of this parameter is highly dependent on your use case. If your transform executes memory-intensive aggregations – for example, cardinality or percentiles – then increasing `max_page_search_size` requires more available memory. If memory limits are exceeded, a circuit breaker exception occurs. diff --git a/explore-analyze/transforms/transform-setup.md b/explore-analyze/transforms/transform-setup.md index 0109cd7f44d..ada9831b21d 100644 --- a/explore-analyze/transforms/transform-setup.md +++ b/explore-analyze/transforms/transform-setup.md @@ -15,7 +15,7 @@ products: To use transforms, you must have: -* at least one [transform node](../../deploy-manage/distributed-architecture/clusters-nodes-shards/node-roles.md#transform-node-role), +* {applies_to}`stack: ga` at least one [transform node](../../deploy-manage/distributed-architecture/clusters-nodes-shards/node-roles.md#transform-node-role), * management features visible in the {{kib}} space, and * security privileges that: * grant use of transforms, and @@ -34,7 +34,10 @@ To *manage* transforms, you must meet all of the following requirements: * `transform_admin` built-in role or `manage_transform` cluster privileges, * `read` and `view_index_metadata` index privileges on source indices, and -* `create_index`, `index`, `manage`, and `read` index privileges on destination indices. If a `retention_policy` is configured, `delete` index privilege is also required on the destination index. +* `read` and `index` index privileges on destination indices. The following privileges are also required on destination indices in these cases: + * `create_index`, if the destination index does not exist yet and the transform creates it, + * `delete`, if a `retention_policy` is configured, + * `manage`, if destination aliases (`dest.aliases`) are configured. The `manage` privilege is also required on the aliases. To view only the configuration and status of transforms, you must have: @@ -46,19 +49,21 @@ For more information about {{es}} roles and privileges, refer to [Built-in roles Within a {{kib}} space, for full access to transforms, you must meet all of the following requirements: -* Management features visible in the {{kib}} space, including `Data View Management` and `Stack Monitoring`, -* `monitoring_user` built-in role, +* Management features visible in the {{kib}} space, including `Data View Management`, +* {applies_to}`stack: ga` `Stack Monitoring` visible in the {{kib}} space, +* {applies_to}`stack: ga` `monitoring_user` built-in role, * `transform_admin` built-in role or `manage_transform` cluster privileges, * `kibana_admin` built-in role or a custom role with `read` or `all` {{kib}} privileges for the `Data View Management` feature (dependent on whether data views already exist for your destination indices), * data views for your source indices, * `read` and `view_index_metadata` index privileges on source indices, and -* `create_index`, `index`, `manage`, and `read` index privileges on destination indices. Additionally, when using a `retention_policy`, `delete` index privilege is required on destination indices. +* `read` and `index` index privileges on destination indices, plus `create_index`, `delete`, or `manage` in the cases described in [{{es}} API user](#transform-es-security-privileges). * `read_pipeline` cluster privileges, if the transform uses an ingest pipeline Within a {{kib}} space, for read-only access to transforms, you must meet all of the following requirements: -* Management features visible in the {{kib}} space, including `Stack Monitoring`, -* `monitoring_user` built-in role, +* Management features visible in the {{kib}} space, +* {applies_to}`stack: ga` `Stack Monitoring` visible in the {{kib}} space, +* {applies_to}`stack: ga` `monitoring_user` built-in role, * `transform_user` built-in role or `monitor_transform` cluster privileges, * `kibana_admin` built-in role or a custom role with `read` {{kib}} privileges for at least one feature in the space, * data views for your source and destination indices, and @@ -70,4 +75,6 @@ For more information and {{kib}} security features, see [{{kib}} role management [Spaces](../../deploy-manage/manage-spaces.md) enable you to organize your source and destination indices and other saved objects in {{kib}} and to see only the objects that belong to your space. However, a transform is a long running task which is managed on cluster level and therefore not limited in scope to certain spaces. Space awareness can be implemented for a {{data-source}} under **Stack Management > Kibana** which allows privileges to the transform destination index. -To successfully create transforms in {{kib}}, you must be logged into a space where the source indices are visible and the `Data View Management` and `Stack Monitoring` features are visible. +To successfully create transforms in {{kib}}, you must be logged into a space where the source indices and the `Data View Management` feature are visible. + +{applies_to}`stack: ga` The `Stack Monitoring` feature must also be visible in the space.