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 true if the collector optimizes change detection
         */
        boolean isOptimized();
        /**
         * Whether the collector requires an extra query to identify the changes.
         *
         * @return true if collector requires an extra query for identifying changes
         */
        boolean queryForChanges();
    }
    /**
     * Deduce mappings based on the input mappings and the known configuration.
     *
     * @param client a client instance for querying the source mappings
     * @param sourceConfig the source configuration
     * @param listener listener to take the deduced mapping
     */
    void deduceMappings(Client client, SourceConfig sourceConfig, ActionListener<Map<String, String>> listener);
    /**
     * Create a preview of the function.
     *
     * @param client a client instance for querying
     * @param headers headers to be used to query only for what the caller is allowed to
     * @param sourceConfig the source configuration
     * @param fieldTypeMap mapping of field types
     * @param numberOfRows number of rows to produce for the preview
     * @param listener listener that takes a list, where every entry corresponds to 1 row/doc in the preview
     */
    void preview(
        Client client,