A preview call can be quite expensive and cause timeout in a cluster. As a short term fix we identified 2 (hopefully) small fixes:

- make the call cancellable, the main issue here seems to be that preview calls search without using a parent task id(see this fix for data feeds: https://github.com/elastic/elasticsearch/pull/88142/files#diff-aba58244cb8f9dfa3ac3b6efeb02259e3d5956576f56c1ff5e243dd2aac27381)
- pass the timeout parameter of the preview call to the search call, currently a timeout can be specified, but is ignored for the inner search call, which is executed with no timeout (see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html#search-search-api-query-params).

Both changes are bugs and shall be relatively simple to implement and considered for backport to the 7.17 branch.

@przemekwitek can you have a look at this?

related: #88010
x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/Function.java
* @return list of fields names
     */
    List<String> getPerformanceCriticalFields();
    /**
     * Runtime validation by querying the source and checking if source and config fit.
     *
     * @param client a client instance for querying the source
     * @param sourceConfig the source configuration
     * @param listener the result listener
     */
    void validateQuery(Client client, SourceConfig sourceConfig, ActionListener<Boolean> listener);
    /**
     * Create a change collector instance and return it
     *
     * @param synchronizationField the field used for synchronizing (continuous mode)
     * @return a change collector instance
     */
    ChangeCollector buildChangeCollector(String synchronizationField);
    /**
     * Get the initial page size for this function.
     *
     * The page size is the main parameter for adjusting memory consumption. Memory consumption mainly depends on
     * the page size, the type of aggregations and the data. As the page size is the number of buckets we return
     * per page the page size is a multiplier for the costs of aggregating bucket.
     *
     * In future we might inspect the configuration and base the initial size on the aggregations used.
     *
     * @return the page size
     */
    int getInitialPageSize();